ConstraintBuilder
Defined in: packages/core/src/access/constraintTypes.ts:246
Position-tracking constraint builder — the type createConstraintBuilder
(access/createConstraintBuilder.ts) returns, and what a rule’s
constraints callback receives. eq pins the field at cursor N and
advances to N + 1; gt/gte/lt/lte (inherited from LowerBoundConstraintBuilder) pin the SAME field and close the chain to
further constraints. This encodes Convex’s complete index rule: zero or
more eq, then at most one lower bound, then at most one upper bound,
fields strictly in index order with no gaps, each value typed per field —
violating any of these is a compile error, never a runtime one.
Type Parameters
Section titled “Type Parameters”TFields
Section titled “TFields”TFields extends readonly string[]
The index’s field tuple, in declaration order —
typically IndexFieldsFor<slug, indexName> (types/generated.ts).
TDoc
Document shape constraint values are typed from.
N extends number = 0
The current field cursor. Defaults to 0, the index’s
first field; only NextConstraintBuilder advances it.
Methods
Section titled “Methods”eq<
F>(field,value):NextConstraintBuilder<TFields,TDoc,N>
Defined in: packages/core/src/access/constraintTypes.ts:251
Type Parameters
Section titled “Type Parameters”F extends string
Parameters
Section titled “Parameters”F
ConstraintValue<TDoc, F>
Returns
Section titled “Returns”NextConstraintBuilder<TFields, TDoc, N>
gt<
F>(field,value):UpperBoundConstraintBuilder<TDoc,TFields[N]>
Defined in: packages/core/src/access/constraintTypes.ts:204
Type Parameters
Section titled “Type Parameters”F extends string
Parameters
Section titled “Parameters”F
ConstraintValue<TDoc, F>
Returns
Section titled “Returns”UpperBoundConstraintBuilder<TDoc, TFields[N]>
Inherited from
Section titled “Inherited from”LowerBoundConstraintBuilder.gt
gte<
F>(field,value):UpperBoundConstraintBuilder<TDoc,TFields[N]>
Defined in: packages/core/src/access/constraintTypes.ts:208
Type Parameters
Section titled “Type Parameters”F extends string
Parameters
Section titled “Parameters”F
ConstraintValue<TDoc, F>
Returns
Section titled “Returns”UpperBoundConstraintBuilder<TDoc, TFields[N]>
Inherited from
Section titled “Inherited from”LowerBoundConstraintBuilder.gte
lt<
F>(field,value):ConstraintResult
Defined in: packages/core/src/access/constraintTypes.ts:187
Type Parameters
Section titled “Type Parameters”F extends string
Parameters
Section titled “Parameters”F
ConstraintValue<TDoc, F>
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”LowerBoundConstraintBuilder.lt
lte<
F>(field,value):ConstraintResult
Defined in: packages/core/src/access/constraintTypes.ts:188
Type Parameters
Section titled “Type Parameters”F extends string
Parameters
Section titled “Parameters”F
ConstraintValue<TDoc, F>
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”LowerBoundConstraintBuilder.lte