package db import ( zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils/logx" "database/sql" "xorm.io/xorm" ) func QueryNativeString(Db *xorm.Engine, sql string, args ...interface{}) ([]map[string]string, error) { results, err := Db.SQL(sql, args...).QueryString() return results, err } func QueryNativeStringSess(sess *xorm.Session, sql string, args ...interface{}) ([]map[string]string, error) { results, err := sess.SQL(sql, args...).QueryString() return results, err } // InsertCommWithSession common insert func InsertCommWithSession(session *xorm.Session, model interface{}) (int64, error) { row, err := session.InsertOne(model) return row, err } // ExecuteOriginalSqlBySession 执行原生sql func ExecuteOriginalSqlBySession(session *xorm.Session, sql string) (sql.Result, error) { result, err := session.Exec(sql) if err != nil { _ = zhios_order_relate_logx.Warn(err) return nil, err } return result, nil } // ExecuteOriginalSql 执行原生sql func ExecuteOriginalSql(Db *xorm.Engine, sql string) (sql.Result, error) { result, err := Db.Exec(sql) if err != nil { _ = zhios_order_relate_logx.Warn(err) return nil, err } return result, nil }