订单分佣规则
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

db.go 1.2 KiB

1 year ago
1 year ago
1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package db
  2. import (
  3. zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils/logx"
  4. "database/sql"
  5. "xorm.io/xorm"
  6. )
  7. func QueryNativeString(Db *xorm.Engine, sql string, args ...interface{}) ([]map[string]string, error) {
  8. results, err := Db.SQL(sql, args...).QueryString()
  9. return results, err
  10. }
  11. func QueryNativeStringSess(sess *xorm.Session, sql string, args ...interface{}) ([]map[string]string, error) {
  12. results, err := sess.SQL(sql, args...).QueryString()
  13. return results, err
  14. }
  15. // InsertCommWithSession common insert
  16. func InsertCommWithSession(session *xorm.Session, model interface{}) (int64, error) {
  17. row, err := session.InsertOne(model)
  18. return row, err
  19. }
  20. // ExecuteOriginalSqlBySession 执行原生sql
  21. func ExecuteOriginalSqlBySession(session *xorm.Session, sql string) (sql.Result, error) {
  22. result, err := session.Exec(sql)
  23. if err != nil {
  24. _ = zhios_order_relate_logx.Warn(err)
  25. return nil, err
  26. }
  27. return result, nil
  28. }
  29. // ExecuteOriginalSql 执行原生sql
  30. func ExecuteOriginalSql(Db *xorm.Engine, sql string) (sql.Result, error) {
  31. result, err := Db.Exec(sql)
  32. if err != nil {
  33. _ = zhios_order_relate_logx.Warn(err)
  34. return nil, err
  35. }
  36. return result, nil
  37. }