postgrelize / json
Function: json() ​
json(
conditionsOrPath,value?):Json
Defined in: src/expressions/methods.ts:101
Accesses a JSON(B) value by path (json('meta.a.b')) or builds JSON conditions (json({ meta: { a: 1 } })).
Parameters ​
conditionsOrPath ​
string | object
Dot-separated path, starting with the attribute name, or a conditions object.
value? ​
string | number | boolean | null
Value to compare with when a path is given.
Returns ​
JSON expression.
Example ​
ts
await User.findAll({ where: json('meta.address.city', 'Berlin') });
await User.findAll({ where: json({ meta: { active: true } }) });