refactor🎨 : 修改文件操作函数

This commit is contained in:
zhangwenjian committed 2020-12-21 22:02:40 +08:00
1 parent 37a2c585e1
commit 746123c888
12 files changed
+128 -169

No files matched your search

+17 -4
View File
@@ -1,14 +1,27 @@
package models
import "time"
type ControlBy struct {
CreateBy uint `gorm:"index;comment:'创建者'"`
UpdateBy uint `gorm:"index;comment:'更新者'"`
CreateBy int `gorm:"index;comment:'创建者'"`
UpdateBy int `gorm:"index;comment:'更新者'"`
}
func (e *ControlBy) SetCreateBy(createBy uint) {
func (e *ControlBy) SetCreateBy(createBy int) {
e.CreateBy = createBy
}
func (e *ControlBy) SetUpdateBy(updateBy uint) {
func (e *ControlBy) SetUpdateBy(updateBy int) {
e.UpdateBy = updateBy
}
type Model struct {
ID int `gorm:"primaryKey;autoIncrement;comment:'主键编码'"`
}
type ModelTime struct {
CreatedAt time.Time `gorm:"comment:'创建时间'"`
UpdatedAt time.Time `gorm:"comment:'最后更新时间'"`
DeletedAt *time.Time `gorm:"index;comment:'删除时间'"`
}
+2 -2
View File
@@ -4,8 +4,8 @@ import "gorm.io/gorm/schema"
type ActiveRecord interface {
schema.Tabler
SetCreateBy(createBy uint)
SetUpdateBy(updateBy uint)
SetCreateBy(createBy int)
SetUpdateBy(updateBy int)
Generate() ActiveRecord
GetId() interface{}
}