mirror of
https://github.com/ent/ent.git
synced 2026-04-28 21:50:56 +03:00
dialect/sql/sqljson: inline boolean values (#3570)
Some drivers like mysql encodes them as 0/1
This commit is contained in:
@@ -36,6 +36,13 @@ func TestWritePath(t *testing.T) {
|
||||
wantQuery: "SELECT * FROM `users` WHERE JSON_EXTRACT(`a`, '$.b.c[1].d') = ?",
|
||||
wantArgs: []any{"a"},
|
||||
},
|
||||
{
|
||||
input: sql.Dialect(dialect.MySQL).
|
||||
Select("*").
|
||||
From(sql.Table("users")).
|
||||
Where(sqljson.ValueEQ("a", true, sqljson.DotPath("b.c[1].d"))),
|
||||
wantQuery: "SELECT * FROM `users` WHERE JSON_EXTRACT(`a`, '$.b.c[1].d') = true",
|
||||
},
|
||||
{
|
||||
input: sql.Dialect(dialect.MySQL).
|
||||
Select("*").
|
||||
|
||||
Reference in New Issue
Block a user