liuhaijun 3f5f28d785 add sheduling agent
Change-Id: I89f35fb3984044c57f10727432755012542f9fd8
2023-11-16 10:55:57 +00:00

41 lines
1.0 KiB
Go

package model
import (
"git.inspur.com/sbg-jszt/cfn/cfn-schedule-agent/data"
"gorm.io/gorm"
"gorm.io/plugin/soft_delete"
"time"
)
type PageData struct {
TotalCount int64
PageSize int
PageNumber int
Data interface{}
}
type BaseModel struct {
ID string `gorm:"column:id;not null;primarykey" json:"id"`
CreateTime time.Time `gorm:"column:create_time;type:timestamp;<-:create" json:"createTime"`
UpdateTime time.Time `gorm:"column:update_time;type:timestamp" json:"updateTime"`
CreatorID string `gorm:"column:creator_id;type:varchar(64);not null;<-:create" json:"creatorID"`
Modifier string `gorm:"column:modifier;type:varchar(64);not null;" json:"modifier"`
}
func (model *BaseModel) DB() *gorm.DB {
return DB()
}
type ContainsDeleteBaseModel struct {
BaseModel
DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at;type:int(11) unsigned;not null;default:0;index" json:"-"`
}
func DB() *gorm.DB {
return data.PostgreSqlDB["data"]
}
func DBAuth() *gorm.DB {
return data.PostgreSqlDB["auth"]
}