Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Paul Lhussiez
committed
Feb 12, 2019
1 parent
538e026
commit 1c2f348
Showing
4 changed files
with
289 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package main | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/jinzhu/gorm" | ||
uuid "github.com/satori/go.uuid" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
type product struct { | ||
ID uuid.UUID `gorm:"primary_key;type:uuid;default:uuid_generate_v4()"` | ||
CreatedAt time.Time | ||
UpdatedAt time.Time | ||
DeletedAt *time.Time | ||
|
||
Name string | ||
Price int | ||
} | ||
|
||
func main() { | ||
db, err := gorm.Open("postgres", "host=myhost port=myport user=gorm dbname=gorm password=mypassword") | ||
if err != nil { | ||
logrus.WithError(err).Fatal("Couldn't initialize database connection") | ||
} | ||
defer db.Close() | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters