querySyntax
querySyntax<
T>(entitySchema,options?):TObject
Defined in: query-syntax.ts:24
Derive a query schema from an entity schema, following the RepositoryService query
convention (Phase 4 TDD §14): every entity field accepts either a bare value or an
operator object ($gt/$gte/$lt/$lte/$ne/$in/$nin, plus $like/$notlike/
$ilike for string fields), and the reserved keys $limit, $skip, $sort, $select,
$or, $and are typed to match. Unknown keys are rejected (additionalProperties: false).
Use it with the validate hook on the query target:
app.service("users").hooks({ before: { find: [validate(querySyntax(userSchema), { target: "query", coerce: true })] },});Type Parameters
Section titled “Type Parameters”T extends TObject<TProperties>
Parameters
Section titled “Parameters”entitySchema
Section titled “entitySchema”T
options?
Section titled “options?”QuerySyntaxOptions = {}
Returns
Section titled “Returns”TObject