ozzo-dbx
ozzo-dbx copied to clipboard
how can i get update rows
db.Update("customer", dbx.Params{"name":json.Name, "age":json.Age}, dbx.HashExp{"id": userId}).Execute()
how can i get update rows
如何得到更新的行数?
Look at the description of Execute
, it says Execute executes the SQL statement without retrieving data.
Use something like this: db.Update("customer", dbx.Params{"name":json.Name, "age":json.Age}, dbx.HashExp{"id": userId}).All(&m)
use either this: .All(), .One(), .Column(), .Row(), .Rows()
@fancyecommerce You can use follow code
result, _:= db.Update("customer", dbx.Params{"name":json.Name, "age":json.Age}, dbx.HashExp{"id": userId}).Execute()
result.RowsAffected()