mirror of
https://github.com/ent/ent.git
synced 2026-04-29 06:00:55 +03:00
dialect/sql/sqljson: add option to evaluate json path inside a predicate (#2982)
* dialect/sql/sqljson: add option to evaluate json path inside a predicate * add postgres test case
This commit is contained in:
@@ -109,10 +109,10 @@ type postgres struct{}
|
||||
func (*postgres) Append(u *sql.UpdateBuilder, column string, elems []any, opts ...Option) {
|
||||
setCase(u, column, when{
|
||||
Cond: func(b *sql.Builder) {
|
||||
ValuePath(b, column, append(opts, Cast("jsonb"))...)
|
||||
valuePath(b, column, append(opts, Cast("jsonb"))...)
|
||||
b.WriteOp(sql.OpIsNull)
|
||||
b.WriteString(" OR ")
|
||||
ValuePath(b, column, append(opts, Cast("jsonb"))...)
|
||||
valuePath(b, column, append(opts, Cast("jsonb"))...)
|
||||
b.WriteOp(sql.OpEQ).WriteString("'null'::jsonb")
|
||||
},
|
||||
Then: func(b *sql.Builder) {
|
||||
|
||||
Reference in New Issue
Block a user