|
@ -1,20 +1,20 @@ |
|
|
package comms |
|
|
package comms |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
gocloud "github.com/mgr9525/go-cloud" |
|
|
|
|
|
"github.com/sirupsen/logrus" |
|
|
"github.com/sirupsen/logrus" |
|
|
|
|
|
"xorm.io/xorm" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
// columns 第一个参数为where条件,(可选:第二个参数为表结构体或名称,第三个参数为单独获取的列名)
|
|
|
// columns 第一个参数为where条件,(可选:第二个参数为表结构体或名称,第三个参数为单独获取的列名)
|
|
|
func XormOne(id, data interface{}, columns ...interface{}) bool { |
|
|
func XormOne(id, data interface{}, columns ...interface{}) bool { |
|
|
return XormOneDb(DbSysHelper, id, data, columns...) |
|
|
|
|
|
|
|
|
ses := DbSysHelper.GetDB().NewSession() |
|
|
|
|
|
defer ses.Close() |
|
|
|
|
|
return XormOneDb(ses, id, data, columns...) |
|
|
} |
|
|
} |
|
|
func XormOneDb(db *gocloud.DBHelper, id, data interface{}, columns ...interface{}) bool { |
|
|
|
|
|
|
|
|
func XormOneDb(ses *xorm.Session, id, data interface{}, columns ...interface{}) bool { |
|
|
if id == nil { |
|
|
if id == nil { |
|
|
return false |
|
|
return false |
|
|
} |
|
|
} |
|
|
ses := db.GetDB().NewSession() |
|
|
|
|
|
defer ses.Close() |
|
|
|
|
|
|
|
|
|
|
|
col := "id" |
|
|
col := "id" |
|
|
if len(columns) > 0 { |
|
|
if len(columns) > 0 { |
|
|