Repository interface

The CRUD surface exposed for one model.

Signature:

export interface Repository<Entity = unknown> 

Remarks

Entity is the model's own row type, which the generated Repositories supplies — Repository<Shape> — so a call site reads a shape without naming one. A read that projects something narrower still says so: single<{ id: string }>({ select: { id: true } }).

Methods

Method

Description

count(args)

How many rows match the filter.

create(args)

Insert a row and return it.

createBulk(args)

Insert many rows in one statement, and return them.

list(args)

A page of rows matching the filter.

removeBulk(args)

Delete every row matching the filter.

single(args)

The first row matching the filter, or null.

update(args)

Update a row by id and return it.

updateBulk(args)

Apply the same change to every row matching the filter.

upsert(args)

Insert a row, or update the one already holding its key.

Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.