model.go
raw| 1 | package gorm |
| 2 | |
| 3 | import "time" |
| 4 | |
| 5 | // Model a basic GoLang struct which includes the following fields: ID, CreatedAt, UpdatedAt, DeletedAt |
| 6 | // It may be embedded into your model or you may build your own model without it |
| 7 | // |
| 8 | // type User struct { |
| 9 | // gorm.Model |
| 10 | // } |
| 11 | type Model struct { |
| 12 | ID uint `gorm:"primarykey"` |
| 13 | CreatedAt time.Time |
| 14 | UpdatedAt time.Time |
| 15 | DeletedAt DeletedAt `gorm:"index"` |
| 16 | } |