Count entities matching a filter.
Equality conditions; empty alone counts all rows
Optionalfilter: FilterExpression
Optional portable expression conjoined with where
The matching row count
Insert a new entity.
The column values to insert
The persisted row, including any generated columns. On a deferred-write transaction the row is the one that will be written, and a generated column is therefore not yet known.
Delete an entity by primary key.
The primary key value (scalar or composite record)
true when a row was deleted, false when none matched. On a
deferred-write transaction this reports whether a committed row matched,
and the delete itself lands at commit.
OptionaldeleteDelete a row only while every precondition field equals its value. Optional permanently; deferred-write transaction sources omit this member.
Primary key, conjoined with the precondition
Non-empty string/number equality map on stored values
true when deleted, false for a missing key or failed predicate
Find every entity matching the normalized query.
The fully-resolved query
The matching rows, already filtered, sorted, paginated and projected
Find a single entity by its primary key value.
The key is an EntityKey: a scalar string/number or a
composite record. A composite record is refused by the backend when it
maps to a single column (e.g. Prisma's where: { id }), so widening this
parameter is source-compatible for callers but breaking for an
out-of-repo implementor whose method still declares the scalar-only form.
The primary key value (scalar or composite record)
The row, or null when no row has that key
OptionalfindFind a page of entities by cursor pagination.
Optional. The member exists on every in-repo adapter but is declared
optional so an out-of-repo implementor that cannot page by cursor keeps
compiling. When it is absent, the repository above refuses cursor paging
by name (UnsupportedQueryFeatureError): absence means "cannot page by
cursor", never "there are no more rows" — the distinction an absent
member cannot otherwise preserve.
The fully-resolved query, carrying an incoming cursor
The matching rows plus a nextCursor that is null when no
further page exists
Update an existing entity by primary key.
The primary key value
The columns to merge into the row
The updated row
OptionalupdateUpdate a row only while every precondition field equals its value. Optional permanently: absence means this source cannot write conditionally. Deferred-write transaction sources omit this member.
Primary key, conjoined with the precondition
Non-empty string/number equality map on stored values
Non-empty update payload
The updated row, or null for a missing key or failed predicate
The data-access seam a backend provides per entity.
One instance is bound to one entity (table/model/collection). The data source owns query evaluation end to end: it applies
where,orderBy,offset/limitandselectitself, and the repository above it must not re-apply any of them.Transaction-scoped instances may defer their writes. A backend whose store has no interactive transaction (Cloudflare D1, where a pre-declared
batch()is the only unit of atomicity) has to buffer writes and apply them at commit. On such a backend the write methods below describe what WILL be written rather than what already is, and reads observe committed state only. A backend that defers must document it;D1Adapteris the worked example.Since
0.2.0