mirror of
https://gitee.com/johng/gf
synced 2026-06-06 16:21:40 +08:00
@ -4688,3 +4688,14 @@ func Test_Builder_OmitEmptyWhere(t *testing.T) {
|
||||
t.Assert(count, TableSize)
|
||||
})
|
||||
}
|
||||
|
||||
func Test_Issue1934(t *testing.T) {
|
||||
table := createInitTable()
|
||||
defer dropTable(table)
|
||||
|
||||
gtest.C(t, func(t *gtest.T) {
|
||||
one, err := db.Model(table).Where(" id ", 1).One()
|
||||
t.AssertNil(err)
|
||||
t.Assert(one["id"], 1)
|
||||
})
|
||||
}
|
||||
|
||||
@ -528,7 +528,7 @@ func formatWhereHolder(ctx context.Context, db DB, in formatWhereHolderInput) (n
|
||||
return
|
||||
}
|
||||
// Usually a string.
|
||||
whereStr := gconv.String(in.Where)
|
||||
whereStr := gstr.Trim(gconv.String(in.Where))
|
||||
// Is `whereStr` a field name which composed as a key-value condition?
|
||||
// Eg:
|
||||
// Where("id", 1)
|
||||
|
||||
Reference in New Issue
Block a user