github.com/RichardKnop/go-oauth2-server@v1.0.5-0.20201019163316-d02a401490d0/models/common.go (about) 1 package models 2 3 import ( 4 "time" 5 ) 6 7 // MyGormModel mimixks GormModel but uses uuid's for ID, generated in go 8 type MyGormModel struct { 9 ID string `gorm:"primary_key"` 10 CreatedAt time.Time 11 UpdatedAt time.Time 12 DeletedAt *time.Time 13 } 14 15 // TimestampModel ... 16 type TimestampModel struct { 17 CreatedAt time.Time 18 UpdatedAt time.Time 19 DeletedAt *time.Time 20 } 21 22 // EmailTokenModel is an abstract model which can be used for objects from which 23 // we derive redirect emails (email confirmation, password reset and such) 24 type EmailTokenModel struct { 25 MyGormModel 26 Reference string `sql:"type:varchar(40);unique;not null"` 27 EmailSent bool `sql:"index;not null"` 28 EmailSentAt *time.Time 29 ExpiresAt time.Time `sql:"index;not null"` 30 }