edb_python_code.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. // EdbPythonCode python指标运算代码
  7. type EdbPythonCode struct {
  8. EdbPythonCodeId int `orm:"column(edb_python_code_id);pk"`
  9. EdbInfoId int `description:"指标id"`
  10. EdbCode string `description:"指标编码"`
  11. PythonCode string `description:"python代码"`
  12. ModifyTime time.Time
  13. CreateTime time.Time
  14. }
  15. // Update 更新EdbPythonCode信息
  16. func (edbPythonCode *EdbPythonCode) Update(cols []string) (err error) {
  17. o := orm.NewOrm()
  18. _, err = o.Update(edbPythonCode, cols...)
  19. return
  20. }
  21. // AddEdbPythonCode python指标运算代码
  22. func AddEdbPythonCode(item *EdbPythonCode) (lastId int64, err error) {
  23. o := orm.NewOrm()
  24. lastId, err = o.Insert(item)
  25. return
  26. }
  27. // GetEdbPythonCodeById 根据指标id获取python代码
  28. func GetEdbPythonCodeById(edbInfoId int) (item *EdbPythonCode, err error) {
  29. o := orm.NewOrm()
  30. sql := ` SELECT * FROM edb_python_code WHERE edb_info_id=? `
  31. err = o.Raw(sql, edbInfoId).QueryRow(&item)
  32. return
  33. }