8000 updated · wpcodevo/golang-gorm-postgres@7057d06 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7057d06

Browse files
committed
updated
1 parent f8f6fbb commit 7057d06

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

models/user.model.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
package models
22

33
import (
4+
"time"
5+
46
"github.com/google/uuid"
57
)
68

79
type User struct {
8-
ID uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primary_key"`
9-
Name string `gorm:"type:varchar(255)"`
10-
Email string `gorm:"uniqueIndex"`
11-
}
12-
13-
func (User) UsersTable() string {
14-
return "users"
10+
ID uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primary_key"`
11+
// ID uint `gorm:"primary_key"`
12+
Name string `gorm:"type:varchar(255);not null"`
13+
Email string `gorm:"uniqueIndex;not null"`
14+
CreatedAt time.Time
15+
UpdatedAt time.Time
1516
}

readMe.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
# Build Golang RESTful API with Gorm, Gin and Postgres
1+
# Build Golang RESTful API with Gorm, Gin and Postgres
2+
3+
### How to Setup Golang GORM RESTful API Project with Postgres
4+
5+
[How to Setup Golang GORM RESTful API Project with Postgres](https://codevoweb.com/setup-golang-gorm-restful-api-project-with-postgres/)

0 commit comments

Comments
 (0)
0