gorm: CreatedAt index

This commit is contained in:
naiba 2022-10-24 04:12:51 +00:00
parent 011fc2340a
commit 51655a09a1

View File

@ -1,8 +1,9 @@
package model package model
import ( import (
"gorm.io/gorm"
"time" "time"
"gorm.io/gorm"
) )
const CtxKeyAuthorizedUser = "ckau" const CtxKeyAuthorizedUser = "ckau"
@ -11,7 +12,7 @@ const CacheKeyOauth2State = "p:a:state"
type Common struct { type Common struct {
ID uint64 `gorm:"primaryKey"` ID uint64 `gorm:"primaryKey"`
CreatedAt time.Time `gorm:"<-:create"` CreatedAt time.Time `gorm:"index;<-:create"`
UpdatedAt time.Time `gorm:"autoUpdateTime"` UpdatedAt time.Time `gorm:"autoUpdateTime"`
DeletedAt gorm.DeletedAt `gorm:"index"` DeletedAt gorm.DeletedAt `gorm:"index"`
} }