12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- package binlog
- import (
- "time"
- "github.com/beego/beego/v2/client/orm"
- )
- // BusinessSysInteractionLog 商家系统交互记录表
- type BusinessSysInteractionLog struct {
- ID uint32 `orm:"column(id);pk"`
- 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 := orm.NewOrmUsingDB("data")
- _, err = o.Insert(m)
- return
- }
- // Update 更新数据
- func (m *BusinessSysInteractionLog) Update(cols []string) (err error) {
- o := orm.NewOrmUsingDB("data")
- _, err = o.Update(m, cols...)
- 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 := orm.NewOrmUsingDB("data")
- sql := "SELECT * FROM business_sys_interaction_log WHERE interaction_key = ?"
- err = o.Raw(sql, key).QueryRow(&item)
- return
- }
|