Skip to content

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().

TSchema extends Schema | undefined = undefined

The schema named with from(), if any, which where is checked against.

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.

`0x${string}`

this


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.

`0x${string}`

this

builder.ownedBy("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045")

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.

string

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<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.

E extends readonly (Expression | readonly Expression[])[]

…E & FilterCheck<E, TSchema>

The expressions, as separate arguments or one array.

this

builder.where(eq("category", "docs"))
builder.where(gte("level", i32(10)), lt("level", i32(20)))
builder.where(or(eq("status", "open"), exists("reviewedBy")))