change layout
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
package modelbase
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"lone-services/pkg/utils"
|
||||
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"gorm.io/gorm"
|
||||
"pkg.local/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -137,8 +137,8 @@ func (m Base) Create(data interface{}) error {
|
||||
func (m Base) Edit(w Params, data interface{}) (int64, error) {
|
||||
o := m.setWhere(w)
|
||||
update := make(map[string]interface{})
|
||||
jsonBytes, _ := json.Marshal(data)
|
||||
_ = json.Unmarshal(jsonBytes, &update)
|
||||
jsonBytes, _ := jsoniter.Marshal(data)
|
||||
_ = jsoniter.Unmarshal(jsonBytes, &update)
|
||||
ret := o.Updates(update)
|
||||
return ret.RowsAffected, ignoreNotFound(ret.Error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user