Skip to content

ConstraintBuilder

Defined in: packages/core/src/access/queryConstraintTypes.ts:265

Position-tracking constraint builder — the type createQueryIndexConstraintBuilder (access/createQueryIndexConstraintBuilder.ts) returns, and what a rule’s withIndex.range 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.

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.

eq<F>(field, value): NextConstraintBuilder<TFields, TDoc, N>

Defined in: packages/core/src/access/queryConstraintTypes.ts:270

F extends string

F

ConstraintValue<TDoc, F>

NextConstraintBuilder<TFields, TDoc, N>


gt<F>(field, value): UpperBoundConstraintBuilder<TDoc, TFields[N]>

Defined in: packages/core/src/access/queryConstraintTypes.ts:223

F extends string

F

ConstraintValue<TDoc, F>

UpperBoundConstraintBuilder<TDoc, TFields[N]>

LowerBoundConstraintBuilder.gt


gte<F>(field, value): UpperBoundConstraintBuilder<TDoc, TFields[N]>

Defined in: packages/core/src/access/queryConstraintTypes.ts:227

F extends string

F

ConstraintValue<TDoc, F>

UpperBoundConstraintBuilder<TDoc, TFields[N]>

LowerBoundConstraintBuilder.gte


lt<F>(field, value): ConstraintResult

Defined in: packages/core/src/access/queryConstraintTypes.ts:206

F extends string

F

ConstraintValue<TDoc, F>

ConstraintResult

LowerBoundConstraintBuilder.lt


lte<F>(field, value): ConstraintResult

Defined in: packages/core/src/access/queryConstraintTypes.ts:207

F extends string

F

ConstraintValue<TDoc, F>

ConstraintResult

LowerBoundConstraintBuilder.lte