business_sys_interaction_log.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package binlog
  2. import (
  3. "time"
  4. "github.com/beego/beego/v2/client/orm"
  5. )
  6. // BusinessSysInteractionLog 商家系统交互记录表
  7. type BusinessSysInteractionLog struct {
  8. ID uint32 `orm:"column(id);pk"`
  9. InteractionKey string // 记录Key
  10. InteractionVal string // 记录值
  11. Remark string // 备注
  12. ModifyTime time.Time // 修改日期
  13. CreateTime time.Time // 创建时间
  14. }
  15. // TableName get sql table name.获取数据库表名
  16. func (m *BusinessSysInteractionLog) TableName() string {
  17. return "business_sys_interaction_log"
  18. }
  19. // BusinessSysInteractionLogColumns get sql column name.获取数据库列名
  20. var BusinessSysInteractionLogColumns = struct {
  21. ID string
  22. InteractionKey string
  23. InteractionVal string
  24. Remark string
  25. ModifyTime string
  26. CreateTime string
  27. }{
  28. ID: "id",
  29. InteractionKey: "interaction_key",
  30. InteractionVal: "interaction_val",
  31. Remark: "remark",
  32. ModifyTime: "modify_time",
  33. CreateTime: "create_time",
  34. }
  35. // Create 添加数据
  36. func (m *BusinessSysInteractionLog) Create() (err error) {
  37. o := orm.NewOrmUsingDB("data")
  38. _, err = o.Insert(m)
  39. return
  40. }
  41. // Update 更新数据
  42. func (m *BusinessSysInteractionLog) Update(cols []string) (err error) {
  43. o := orm.NewOrmUsingDB("data")
  44. _, err = o.Update(m, cols...)
  45. return
  46. }
  47. var BinlogFileNameKey = "binlog_edb_info_filename" // binlog文件名
  48. var BinlogPositionKey = "binlog_edb_info_position" // binlog位置
  49. // GetBusinessSysInteractionLogByKey 根据记录key获取数据
  50. func GetBusinessSysInteractionLogByKey(key string) (item *BusinessSysInteractionLog, err error) {
  51. o := orm.NewOrmUsingDB("data")
  52. sql := "SELECT * FROM business_sys_interaction_log WHERE interaction_key = ?"
  53. err = o.Raw(sql, key).QueryRow(&item)
  54. return
  55. }