Skip to main content

Class: QueryLiteral

Defined in: service-core/src/models/ModelUtils.ts:77

A search query value that is compared exactly as given rather than parsed as op(value) syntax. Create one via ModelUtils.literal(). Only code can produce one: a client's query string or q JSON can only ever yield plain strings, arrays and objects.

Constructors​

Constructor​

new QueryLiteral(value, op?): QueryLiteral

Defined in: service-core/src/models/ModelUtils.ts:81

Parameters​

value​

unknown

op?​

LiteralOperator = "eq"

Returns​

QueryLiteral

Properties​

op​

readonly op: LiteralOperator

Defined in: service-core/src/models/ModelUtils.ts:78


value​

readonly value: unknown

Defined in: service-core/src/models/ModelUtils.ts:79

Methods​

toJSON()​

toJSON(): any

Defined in: service-core/src/models/ModelUtils.ts:92

Serializes under a $-prefixed key so a query containing a literal hashes (e.g. for RepoUtils' result cache) differently from any plain value, and so a client echoing the same JSON back is rejected by the query builders' operator-injection guard instead of being mistaken for a literal.

Returns​

any