- sku category man almost ok.
- mysql connect str add utf8mb4.
This commit is contained in:
@@ -69,11 +69,11 @@ func GetRows(db *DaoDB, inPtr interface{}, sql string, values ...interface{}) (e
|
||||
return err
|
||||
}
|
||||
|
||||
func GetEntity(db *DaoDB, item interface{}, cols ...string) error {
|
||||
func GetEntity(db *DaoDB, item interface{}, cols ...string) (err error) {
|
||||
if db == nil {
|
||||
db = GetDB()
|
||||
}
|
||||
err := utils.CallFuncLogError(func() error {
|
||||
err = utils.CallFuncLogError(func() error {
|
||||
return db.db.Read(item, cols...)
|
||||
}, reflect.TypeOf(item).Name())
|
||||
return err
|
||||
@@ -109,13 +109,13 @@ func UpdateEntityByKV(db *DaoDB, item interface{}, kvs map[string]interface{}, c
|
||||
return num, err
|
||||
}
|
||||
|
||||
func CreateEntity(db *DaoDB, item interface{}) error {
|
||||
func CreateEntity(db *DaoDB, item interface{}) (err error) {
|
||||
if db == nil {
|
||||
db = GetDB()
|
||||
}
|
||||
err := utils.CallFuncLogError(func() error {
|
||||
_, err2 := db.db.Insert(item) // todo 这里需要将ID赋值么?
|
||||
return err2
|
||||
err = utils.CallFuncLogError(func() error {
|
||||
_, err = db.db.Insert(item) // todo 这里需要将ID赋值么?
|
||||
return err
|
||||
}, reflect.TypeOf(item).Name())
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user