QueryBuilderBase
Defined in: src/query/builderBase.ts:61
What every query builder shares: the client, the filters — where, ownedBy, createdBy and a
named schema’s tag — and the block to read at. client.select() and client.count() build on it,
so the same filters always send the same query string, whichever of them runs it.
Not constructed directly: create a builder with client.select(...) or client.count().
Extended by
Section titled “Extended by”Type Parameters
Section titled “Type Parameters”TSchema
Section titled “TSchema”TSchema extends Schema | undefined = undefined
The schema named with from(), if any, which where is checked against.
Methods
Section titled “Methods”createdBy()
Section titled “createdBy()”createdBy(
creator):this
Defined in: src/query/builderBase.ts:123
Restricts the query to entities this account created — shorthand for
where(eq("$creator", addr(creator))). Calling it again replaces the filter.
The creator never changes; the owner does, so these differ after a transfer.
Parameters
Section titled “Parameters”creator
Section titled “creator”`0x${string}`
Returns
Section titled “Returns”this
ownedBy()
Section titled “ownedBy()”ownedBy(
owner):this
Defined in: src/query/builderBase.ts:112
Restricts the query to entities this account owns — shorthand for
where(eq("$owner", addr(owner))). Calling it again replaces the filter.
Parameters
Section titled “Parameters”`0x${string}`
Returns
Section titled “Returns”this
Example
Section titled “Example”builder.ownedBy("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045")toString()
Section titled “toString()”toString():
string
Defined in: src/query/builderBase.ts:135
The query string this builder will send — the same text the node parses: its filters,
ownedBy and createdBy, and a named schema’s tag, ANDed.
Returns
Section titled “Returns”string
Throws
Section titled “Throws”If no filter has been added, or — after from() — a filter
does not fit the schema. A named schema’s own tag filter counts as a filter.
where()
Section titled “where()”where<
E>(…expressions):this
Defined in: src/query/builderBase.ts:98
Adds filters. Everything passed here, and across repeated calls, must hold.
After from(), every attribute a filter names must be an indexed column of the schema,
compared against a value of its type — anything else is a compile error.
Type Parameters
Section titled “Type Parameters”E extends readonly (Expression | readonly Expression[])[]
Parameters
Section titled “Parameters”expressions
Section titled “expressions”…E & FilterCheck<E, TSchema>
The expressions, as separate arguments or one array.
Returns
Section titled “Returns”this
Example
Section titled “Example”builder.where(eq("category", "docs"))builder.where(gte("level", i32(10)), lt("level", i32(20)))builder.where(or(eq("status", "open"), exists("reviewedBy")))