postgrelize / jsonbPath
Function: jsonbPath() ​
jsonbPath(
kind,target,path,options?):Fn
Defined in: src/expressions/jsonpath-helpers.ts:66
postgrelize extensionCalls a jsonb_path_* function (exists, match, query, queryFirst, queryArray) with a bound jsonpath. PostgreSQL extension.
Op.jsonPathExists (@?) and Op.match (@@) are the operator forms of exists and match.
Parameters ​
kind ​
Which function to call.
target ​
unknown
jsonb expression, e.g. col('doc').
path ​
string
jsonpath text, bound as a parameter. Invalid syntax is a database error.
options? ​
JsonbPathOptions = {}
vars, silent and tz.
Returns ​
Function call expression.
Throws ​
Error when kind is not one of the five names.
Example ​
ts
await Product.findAll({ where: where(jsonbPath('exists', col('attrs'), '$.price ? (@ > $min)', { vars: { min: 10 } }), true) });