From 011fc2340a857422477e43f4ae33ccf4d8ed230d Mon Sep 17 00:00:00 2001 From: owen Date: Sun, 23 Oct 2022 23:53:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=97=A5=E6=9C=9F=E5=BD=92=E9=9B=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/common.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/model/common.go b/model/common.go index fc51e7c..a3628da 100644 --- a/model/common.go +++ b/model/common.go @@ -1,6 +1,7 @@ package model import ( + "gorm.io/gorm" "time" ) @@ -9,10 +10,10 @@ const CtxKeyViewPasswordVerified = "ckvpv" const CacheKeyOauth2State = "p:a:state" type Common struct { - ID uint64 `gorm:"primaryKey"` - CreatedAt time.Time `sql:"index"` - UpdatedAt time.Time - DeletedAt *time.Time `sql:"index"` + ID uint64 `gorm:"primaryKey"` + CreatedAt time.Time `gorm:"<-:create"` + UpdatedAt time.Time `gorm:"autoUpdateTime"` + DeletedAt gorm.DeletedAt `gorm:"index"` } type Response struct {