1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- package index
- import (
- "eta/eta_bridge/global"
- "time"
- )
- // BusinessSysInteractionLog 商家系统交互记录表
- type BusinessSysInteractionLog struct {
- ID uint32 `gorm:"primaryKey;column:id;type:int(10) unsigned;not null" json:"-"`
- InteractionKey string `gorm:"unique;column:interaction_key;type:varchar(128);not null;default:''" json:"interactionKey"` // 记录Key
- InteractionVal string `gorm:"column:interaction_val;type:text;default:null" json:"interactionVal"` // 记录值
- Remark string `gorm:"column:remark;type:varchar(128);not null;default:''" json:"remark"` // 备注
- ModifyTime time.Time `gorm:"column:modify_time;type:datetime;default:null" json:"modifyTime"` // 修改日期
- CreateTime time.Time `gorm:"column:create_time;type:datetime;default:null" json:"createTime"` // 创建时间
- }
- // TableName get sql table name.获取数据库表名
- func (m *BusinessSysInteractionLog) TableName() string {
- return "business_sys_interaction_log"
- }
- // BusinessSysInteractionLogColumns get sql column name.获取数据库列名
- var BusinessSysInteractionLogColumns = struct {
- ID string
- InteractionKey string
- InteractionVal string
- Remark string
- ModifyTime string
- CreateTime string
- }{
- ID: "id",
- InteractionKey: "interaction_key",
- InteractionVal: "interaction_val",
- Remark: "remark",
- ModifyTime: "modify_time",
- CreateTime: "create_time",
- }
- // Create 添加数据
- func (m *BusinessSysInteractionLog) Create() (err error) {
- err = global.MYSQL["index"].Create(m).Error
- return
- }
- // Update 更新数据
- func (m *BusinessSysInteractionLog) Update(cols []string) (err error) {
- err = global.MYSQL["index"].Model(m).Select(cols).Updates(m).Error
- return
- }
- var BinlogFileNameKey = "binlog_filename" // binlog文件名
- var BinlogPositionKey = "binlog_binlog_position" // binlog位置
- // GetBusinessSysInteractionLogByKey 根据记录key获取数据
- func GetBusinessSysInteractionLogByKey(key string) (item *BusinessSysInteractionLog, err error) {
- err = global.MYSQL["index"].Where("interaction_key = ?", key).First(&item).Error
- return
- }
|