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.
24 lines
491 B
24 lines
491 B
package comms
|
|
|
|
import gocloud "github.com/mgr9525/go-cloud"
|
|
|
|
func XormOne(id, e interface{}, column ...string) bool {
|
|
return XormOneDb(DbSysHelper, id, e, column...)
|
|
}
|
|
func XormOneDb(db *gocloud.DBHelper, id, e interface{}, column ...string) bool {
|
|
if id == nil {
|
|
return false
|
|
}
|
|
col := "id"
|
|
if len(column) > 0 && column[0] != "" {
|
|
col = column[0]
|
|
}
|
|
has, err := db.GetDB().Where(col+" = ?", id).Get(e)
|
|
if err != nil {
|
|
return false
|
|
}
|
|
if !has {
|
|
return false
|
|
}
|
|
return true
|
|
}
|