- sku category man almost ok.

- mysql connect str add utf8mb4.
This commit is contained in:
gazebo
2018-09-09 20:43:48 +08:00
parent d71b0e6763
commit d8907cf010
14 changed files with 304 additions and 41 deletions

View File

@@ -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
}