Update model.go

improvement in gorm Model
This commit is contained in:
juancer 2021-01-23 05:45:22 +01:00 committed by GitHub
parent 35ebfe6874
commit ba5bfca733
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,8 +8,12 @@ import "time"
// gorm.Model
// }
type Model struct {
ID uint `gorm:"primarykey"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt DeletedAt `gorm:"index"`
ID int64 `gorm:"primarykey" json:"id"`
CreatedBy int64 `gorm:"created_by" json:"created_by,omitempty"`
UpdatedBy int64 `gorm:"updated_by" json:"updated_by,omitempty"`
DeletedBy int64 `gorm:"deleted_by" json:"deleted_by,omitempty"`
Deleted bool `gorm:"deleted" json:"deleted"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
DeletedAt *time.Time `gorm:"index" json:"deleted_at,omitempty"`
}