MCPcopy
hub / github.com/ent/ent / ValueEQ

Function ValueEQ

dialect/sql/sqljson/sqljson.go:95–107  ·  view source on GitHub ↗

ValueEQ return a predicate for checking that a JSON value (returned by the path) is equal to the given argument. sqljson.ValueEQ("a", 1, sqljson.Path("b"))

(column string, arg any, opts ...Option)

Source from the content-addressed store, hash-verified

93//
94// sqljson.ValueEQ("a", 1, sqljson.Path("b"))
95func ValueEQ(column string, arg any, opts ...Option) *sql.Predicate {
96 return sql.P(func(b *sql.Builder) {
97 opts = normalizePG(b, arg, opts)
98 valuePath(b, column, opts...)
99 b.WriteOp(sql.OpEQ)
100 // Inline boolean values, as some drivers (e.g., MySQL) encode them as 0/1.
101 if v, ok := arg.(bool); ok {
102 b.WriteString(strconv.FormatBool(v))
103 } else {
104 b.Arg(arg)
105 }
106 })
107}
108
109// ValueNEQ return a predicate for checking that a JSON value
110// (returned by the path) is not equal to the given argument.

Callers 2

PredicatesFunction · 0.92
TestWritePathFunction · 0.92

Calls 6

PStruct · 0.92
normalizePGFunction · 0.85
valuePathFunction · 0.85
WriteOpMethod · 0.80
WriteStringMethod · 0.80
ArgMethod · 0.80

Tested by 2

PredicatesFunction · 0.74
TestWritePathFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…