1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- package binlog
- import (
- "time"
- "eta/eta_api/global"
- "eta/eta_api/utils"
- )
- // BusinessSysInteractionLog 商家系统交互记录表
- type BusinessSysInteractionLog struct {
- ID uint32 `orm:"column(id);pk" gorm:"primaryKey"`
- InteractionKey string // 记录Key
- InteractionVal string // 记录值
- Remark string // 备注
- ModifyTime time.Time // 修改日期
- CreateTime time.Time // 创建时间
- }
- // 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) {
- o := global.DbMap[utils.DbNameIndex]
- err = o.Create(m).Error
- return
- }
- // Update 更新数据
- func (m *BusinessSysInteractionLog) Update(cols []string) (err error) {
- o := global.DbMap[utils.DbNameIndex]
- err = o.Model(m).Select(cols).Updates(m).Error
- return
- }
- var BinlogFileNameKey = "binlog_edb_info_filename" // binlog文件名
- var BinlogPositionKey = "binlog_edb_info_position" // binlog位置
- // GetBusinessSysInteractionLogByKey 根据记录key获取数据
- func GetBusinessSysInteractionLogByKey(key string) (item *BusinessSysInteractionLog, err error) {
- o := global.DbMap[utils.DbNameIndex]
- sql := "SELECT * FROM business_sys_interaction_log WHERE interaction_key = ?"
- err = o.Raw(sql, key).First(&item).Error
- return
- }
|