feat: complete settings

This commit is contained in:
engigu
2024-01-01 12:03:56 +08:00
parent 66b3a30a62
commit 4a1e663396
19 changed files with 242 additions and 155 deletions
+1 -2
View File
@@ -47,7 +47,7 @@ func Setup() {
return setting.DatabaseSetting.TablePrefix + defaultTableName
}
db.LogMode(true)
//db.LogMode(true)
db.SingularTable(true)
db.Callback().Create().Replace("gorm:update_time_stamp", updateTimeStampForCreateCallback)
db.Callback().Update().Replace("gorm:update_time_stamp", updateTimeStampForUpdateCallback)
@@ -65,7 +65,6 @@ func CloseDB() {
func updateTimeStampForCreateCallback(scope *gorm.Scope) {
if !scope.HasError() {
nowTime := time.Now()
fmt.Printf("fyyyyyynowTime %s", nowTime)
if createTimeField, ok := scope.FieldByName("CreatedOn"); ok {
if createTimeField.IsBlank {