a
This commit is contained in:
@@ -78,7 +78,7 @@ func Update(db *sqlx.DB, obj interface{}, fields ...string) (err error) {
|
|||||||
}
|
}
|
||||||
sql.WriteString(strings.Join(fieldsStr, ","))
|
sql.WriteString(strings.Join(fieldsStr, ","))
|
||||||
sql.WriteString(" WHERE id = ?")
|
sql.WriteString(" WHERE id = ?")
|
||||||
for i := 0; i < stype.NumField()-1; i++ {
|
for i := 1; i < stype.NumField(); i++ {
|
||||||
if fieldsMap[stype.Field(i).Tag.Get("json")] != "" {
|
if fieldsMap[stype.Field(i).Tag.Get("json")] != "" {
|
||||||
if stype.Field(i).Type.String() == "*time.Time" {
|
if stype.Field(i).Type.String() == "*time.Time" {
|
||||||
if direct.Field(i).Interface().(*time.Time) != nil {
|
if direct.Field(i).Interface().(*time.Time) != nil {
|
||||||
@@ -94,6 +94,7 @@ func Update(db *sqlx.DB, obj interface{}, fields ...string) (err error) {
|
|||||||
if direct.Field(0).Int() == 0 {
|
if direct.Field(0).Int() == 0 {
|
||||||
return err
|
return err
|
||||||
} else {
|
} else {
|
||||||
|
fmt.Println("11111111", direct.Field(0).Int())
|
||||||
sqlParams = append(sqlParams, direct.Field(0).Int())
|
sqlParams = append(sqlParams, direct.Field(0).Int())
|
||||||
}
|
}
|
||||||
fmt.Println(sql.String())
|
fmt.Println(sql.String())
|
||||||
|
|||||||
Reference in New Issue
Block a user