github.com/resonatecoop/user-api@v1.0.0-13.0.20220915120639-05dc9c04014a/model/common.go (about) 1 package model 2 3 import ( 4 "time" 5 6 "github.com/google/uuid" 7 ) 8 9 // MyGormModel mimixks GormModel but uses uuid's for ID, generated in go 10 type IDRecord struct { 11 ID uuid.UUID `bun:"type:uuid,default:uuid_generate_v4()"` 12 CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"` 13 UpdatedAt time.Time 14 DeletedAt time.Time `bun:",soft_delete"` 15 } 16 17 // TimestampModel ... 18 // type TimestampModel struct { 19 // CreatedAt time.Time `bun:"default:now()"` 20 // UpdatedAt time.Time 21 // DeletedAt *time.Time 22 // }