Create modelp.go

This commit is contained in:
snowdream 2025-05-17 13:31:49 +08:00 committed by GitHub
parent e5b867e785
commit fa43bddebe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

16
modelp.go Normal file
View File

@ -0,0 +1,16 @@
package gorm
import "time"
// ModelP a basic GoLang struct which includes the following fields: ID, CreatedAt, UpdatedAt, DeletedAt
// It may be embedded into your model or you may build your own model without it
//
// type User struct {
// gorm.ModelP
// }
type ModelP struct {
ID uint `gorm:"primarykey"`
CreatedAt *time.Time
UpdatedAt *time.Time
DeletedAt *DeletedAt `gorm:"index"`
}