dialect/sql/sqljson: add {lt,lte} to predicates (#757)

This commit is contained in:
Ariel Mashraki
2020-09-13 16:12:37 +03:00
committed by GitHub
parent 690e9cd402
commit cbff065b51
2 changed files with 31 additions and 3 deletions

View File

@@ -101,10 +101,12 @@ func TestWritePath(t *testing.T) {
sqljson.ValueNEQ("a", 1, sqljson.Path("b")),
sqljson.ValueGT("a", 1, sqljson.Path("c")),
sqljson.ValueGTE("a", 1, sqljson.Path("d")),
sqljson.ValueLT("a", 1, sqljson.Path("e")),
sqljson.ValueLTE("a", 1, sqljson.Path("f")),
),
),
wantQuery: `SELECT * FROM "users" WHERE "a"->'b' <> $1 OR "a"->'c' > $2 OR "a"->'d' >= $3`,
wantArgs: []interface{}{1, 1, 1},
wantQuery: `SELECT * FROM "users" WHERE "a"->'b' <> $1 OR "a"->'c' > $2 OR "a"->'d' >= $3 OR "a"->'e' < $4 OR "a"->'f' <= $5`,
wantArgs: []interface{}{1, 1, 1, 1, 1},
},
}
for i, tt := range tests {