File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 1
1
package models
2
2
3
3
import (
4
+ "time"
5
+
4
6
"github.com/google/uuid"
5
7
)
6
8
7
9
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
15
16
}
Original file line number Diff line number Diff line change 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/ )
You can’t perform that action at this time.
0 commit comments