Classes

@system-inc/base-foundation · 515c140 · 24 symbols

SQLite dialect base. Concrete drivers (D1, Durable Objects, BetterSQLite) extend this for their connection setup, transaction model, and result conversion. Shared CRUD lives on DrizzleAdapterBase; only operations that need the SQLite variable-limit batching, the ON CONFLICT upsert syntax, or SQLite-specific strftime/datetime time bucketing live here.

extends SQLiteAdapter

Members

  • adapterType: "drizzle"

  • databaseType: { dialect: "sqlite"; driver: "d1" | "durable" | "better-sqlite" }

  • supportsInteractiveTransactions: boolean

    Default: every Drizzle adapter except D1 can wrap writeBatch in a native transaction. D1 overrides this to false (only supports db.batch(), which writeBatch maps to natively).

  • count(metadata: OrmTableMetadata, options?: OrmFindOptionsMany<EntityType>): Promise<number>

  • decrement(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>, column: keyof EntityType & string, value: number, additionalSet?: Record<string, unknown>): Promise<OrmUpdateResult<EntityType>>

  • delete(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>): Promise<OrmDeleteResult<EntityType>>

  • deleteBatch(metadata: OrmTableMetadata, conditions: readonly (Partial<Pick<EntityType, NonFnKeys<EntityType>>>)[]): Promise<OrmDeleteResult<EntityType>>

  • dispose(): Promise<void>

  • execute(query: string | SQLWrapper): Promise<any>

  • executeRows(query: string | SQLWrapper): Promise<RowType[]>

    Runs a raw query and returns its result rows, normalized from the driver's shape into a plain array. See OrmDatabase.executeRows.

  • find(metadata: OrmTableMetadata, options?: OrmFindOptionsMany<EntityType>): Promise<(OrmRawData<EntityType>)[]>

  • findAndCount(metadata: OrmTableMetadata, options?: OrmFindOptionsMany<EntityType>): Promise<[(OrmRawData<EntityType>)[], number]>

  • findOne(metadata: OrmTableMetadata, options?: OrmFindOptions<EntityType>): Promise<OrmRawData<EntityType> | null>

  • increment(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>, column: keyof EntityType & string, value: number, additionalSet?: Record<string, unknown>): Promise<OrmUpdateResult<EntityType>>

  • insert(metadata: OrmTableMetadata, values: readonly (Partial<Pick<EntityType, NonFnKeys<EntityType>>>)[]): Promise<OrmInsertResult<EntityType>>

  • safeBatchSize(columnCount: number): number

    Returns the largest chunk size that keeps a single statement's bound parameters under this.maxSQLVariables, with a 10% headroom for other parameters in the same query. Pass 1 for a list of scalar IDs.

  • timeSeries(tableName: string, column: string, options: OrmTimeSeriesOptions<object>): Promise<OrmTimeSeriesResult[]>

    Builds a time-bucketed histogram with conditional counts using direct aggregation.

    • Uses GROUP BY on time buckets directly from table data.
    • Much faster than CTE + JOIN approach for large datasets.
    • Returns OrmTimeSeriesResult format.
  • transaction(context: OrmDatabaseImpl, callback: (tx: OrmTransaction) => Promise<T>): Promise<T>

    Interactive read-write transaction. Throws on adapters where supportsInteractiveTransactions === false (D1). For portable atomic writes, use writeBatch.

  • truncate(metadata: OrmTableMetadata): Promise<OrmDeleteResult<EntityType>>

  • update(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>, values: OrmPartialEntity<EntityType>): Promise<OrmUpdateResult<EntityType>>

  • updateBatch(metadata: OrmTableMetadata, operations: readonly ({ conditions: OrmPartialEntity<EntityType>; values: OrmPartialEntity<EntityType> })[]): Promise<OrmUpdateResult<EntityType>>

  • upsert(metadata: OrmTableMetadata, conditions: OrmPartialEntity<EntityType>, values: OrmPartialEntity<EntityType>): Promise<OrmInsertResult<EntityType>>

    Native upsert — single atomic statement using the dialect's conflict resolution syntax (ON CONFLICT DO UPDATE on SQLite/Postgres, ON DUPLICATE KEY UPDATE on MySQL). The dialect-specific work lives in upsertBatch; this is the single-row convenience wrapper.

    conditions holds the entity's identifying fields (typically the primary key). It's not a where clause — there's no read involved.

  • upsertBatch(metadata: OrmTableMetadata, operations: readonly ({ conditions: OrmPartialEntity<EntityType>; values: OrmPartialEntity<EntityType> })[]): Promise<OrmInsertResult<EntityType>>

  • writeBatch(operations: readonly OrmBatchOperation[]): Promise<OrmBatchResult>

    better-sqlite3's .transaction() is synchronous and (since v12) throws if the callback returns a promise, so the inherited async writeBatch (DrizzleAdapterBase) hits that guard. Run the batch synchronously inside the transaction instead: drizzle's better-sqlite3 session runs the callback synchronously and returns its value directly. This is also strictly MORE correct than the async path was here — an async callback resolved to a promise that committed at the first await, so the batch ran auto-committed outside any transaction (silently non-atomic). Production drivers are unaffected: PlanetScale keeps the async base path (its session awaits), and D1 / Durable Objects override writeBatch entirely.

View source ↗

implements OrmAdapterProviderBetterSQLite<"drizzle">

Members

View source ↗

SQLite dialect base. Concrete drivers (D1, Durable Objects, BetterSQLite) extend this for their connection setup, transaction model, and result conversion. Shared CRUD lives on DrizzleAdapterBase; only operations that need the SQLite variable-limit batching, the ON CONFLICT upsert syntax, or SQLite-specific strftime/datetime time bucketing live here.

extends SQLiteAdapter

Members

  • adapterType: "drizzle"

  • databaseType: { dialect: "sqlite"; driver: "d1" | "durable" | "better-sqlite" }

  • supportsInteractiveTransactions: false

    Default: every Drizzle adapter except D1 can wrap writeBatch in a native transaction. D1 overrides this to false (only supports db.batch(), which writeBatch maps to natively).

  • count(metadata: OrmTableMetadata, options?: OrmFindOptionsMany<EntityType>): Promise<number>

  • decrement(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>, column: keyof EntityType & string, value: number, additionalSet?: Record<string, unknown>): Promise<OrmUpdateResult<EntityType>>

  • delete(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>): Promise<OrmDeleteResult<EntityType>>

  • deleteBatch(metadata: OrmTableMetadata, conditions: readonly (Partial<Pick<EntityType, NonFnKeys<EntityType>>>)[]): Promise<OrmDeleteResult<EntityType>>

  • dispose(): Promise<void>

  • execute(query: string | SQLWrapper): Promise<any>

  • executeRows(query: string | SQLWrapper): Promise<RowType[]>

    Runs a raw query and returns its result rows, normalized from the driver's shape into a plain array. See OrmDatabase.executeRows.

  • find(metadata: OrmTableMetadata, options?: OrmFindOptionsMany<EntityType>): Promise<(OrmRawData<EntityType>)[]>

  • findAndCount(metadata: OrmTableMetadata, options?: OrmFindOptionsMany<EntityType>): Promise<[(OrmRawData<EntityType>)[], number]>

  • findOne(metadata: OrmTableMetadata, options?: OrmFindOptions<EntityType>): Promise<OrmRawData<EntityType> | null>

  • increment(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>, column: keyof EntityType & string, value: number, additionalSet?: Record<string, unknown>): Promise<OrmUpdateResult<EntityType>>

  • insert(metadata: OrmTableMetadata, values: readonly (Partial<Pick<EntityType, NonFnKeys<EntityType>>>)[]): Promise<OrmInsertResult<EntityType>>

  • safeBatchSize(columnCount: number): number

    Returns the largest chunk size that keeps a single statement's bound parameters under this.maxSQLVariables, with a 10% headroom for other parameters in the same query. Pass 1 for a list of scalar IDs.

  • timeSeries(tableName: string, column: string, options: OrmTimeSeriesOptions<object>): Promise<OrmTimeSeriesResult[]>

    Builds a time-bucketed histogram with conditional counts using direct aggregation.

    • Uses GROUP BY on time buckets directly from table data.
    • Much faster than CTE + JOIN approach for large datasets.
    • Returns OrmTimeSeriesResult format.
  • transaction(_context: OrmDatabaseImpl, _callback: (tx: OrmTransaction) => Promise<T>): Promise<T>

    Interactive read-write transaction. Throws on adapters where supportsInteractiveTransactions === false (D1). For portable atomic writes, use writeBatch.

  • truncate(metadata: OrmTableMetadata): Promise<OrmDeleteResult<EntityType>>

  • update(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>, values: OrmPartialEntity<EntityType>): Promise<OrmUpdateResult<EntityType>>

  • updateBatch(metadata: OrmTableMetadata, operations: readonly ({ conditions: OrmPartialEntity<EntityType>; values: OrmPartialEntity<EntityType> })[]): Promise<OrmUpdateResult<EntityType>>

  • upsert(metadata: OrmTableMetadata, conditions: OrmPartialEntity<EntityType>, values: OrmPartialEntity<EntityType>): Promise<OrmInsertResult<EntityType>>

    Native upsert — single atomic statement using the dialect's conflict resolution syntax (ON CONFLICT DO UPDATE on SQLite/Postgres, ON DUPLICATE KEY UPDATE on MySQL). The dialect-specific work lives in upsertBatch; this is the single-row convenience wrapper.

    conditions holds the entity's identifying fields (typically the primary key). It's not a where clause — there's no read involved.

  • upsertBatch(metadata: OrmTableMetadata, operations: readonly ({ conditions: OrmPartialEntity<EntityType>; values: OrmPartialEntity<EntityType> })[]): Promise<OrmInsertResult<EntityType>>

  • writeBatch(operations: readonly OrmBatchOperation[]): Promise<OrmBatchResult>

    D1 has no interactive transactions — use db.batch([...]) for atomic batched writes instead. Builds Drizzle query handles (unawaited), passes them to D1's batch API, then maps results back to the input operation order. No-op operations (e.g. an update with an empty where clause) are returned as zero-affected without occupying a batch slot.

View source ↗

implements OrmAdapterProviderD1<"drizzle">

Members

View source ↗

Binding for a named ORM data context. The name corresponds to a registered configuration. Used with @InjectDatabase(...) and as the optional database selector for the ORM @InjectRepository(...).

extends TypedBinding

Members

  • name: string

  • toString(): string

View source ↗

Shared logic for Drizzle-backed adapters. Owns the dialect-agnostic CRUD methods (count/find/update/delete/upsert/increment/decrement/...) and filter/query-options building. Subclasses provide the driver-specific pieces: the Drizzle db instance, transaction handling, batched mutators (insert / updateBatch / deleteBatch / upsertBatch — different batching/conflict semantics per dialect), and result conversion.

this.db is typed any because the chained query builders Drizzle returns differ across dialects; structurally typing the surface would mean re-declaring most of Drizzle's API. The dialect-specific subclasses narrow it back to a typed MySqlDb/SQLiteDb/etc. in their own field declaration.

implements OrmAdapter

Members

  • adapterType: "drizzle"

  • databaseType: OrmDatabaseType

  • db: any

  • maxSQLVariables: number

  • schema: Record<string, object>

  • supportsInteractiveTransactions: boolean

    Default: every Drizzle adapter except D1 can wrap writeBatch in a native transaction. D1 overrides this to false (only supports db.batch(), which writeBatch maps to natively).

  • buildBatchUpsertQuery(dbOrTx: any, metadata: OrmTableMetadata, table: object, conditions: OrmPartialEntity<object>, values: OrmPartialEntity<object>): any

    Dialect-specific upsert query construction. SQLite/Postgres use ON CONFLICT DO UPDATE, MySQL uses ON DUPLICATE KEY UPDATE. Subclasses provide the actual builder.

  • convertDeleteResult(driverResult: any): OrmDeleteResult<EntityType>

    Convert driver-specific delete result to ORM delete result.

  • convertInsertResult(driverResult: any): OrmInsertResult<EntityType>

    Convert driver-specific insert result to ORM insert result.

  • convertUpdateResult(driverResults: any[]): OrmUpdateResult<EntityType>

    Convert driver-specific update result(s) to ORM update result.

  • convertUpsertResult(driverResults: any[]): OrmInsertResult<EntityType>

    Convert driver-specific upsert result(s) to ORM insert result.

  • count(metadata: OrmTableMetadata, options?: OrmFindOptionsMany<EntityType>): Promise<number>

  • decrement(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>, column: keyof EntityType & string, value: number, additionalSet?: Record<string, unknown>): Promise<OrmUpdateResult<EntityType>>

  • delete(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>): Promise<OrmDeleteResult<EntityType>>

  • deleteBatch(metadata: OrmTableMetadata, conditions: readonly (Partial<Pick<EntityType, NonFnKeys<EntityType>>>)[]): Promise<OrmDeleteResult<EntityType>>

  • dispose(): Promise<void>

  • execute(query: string | SQLWrapper): Promise<any>

  • executeRows(query: string | SQLWrapper): Promise<RowType[]>

    Runs a raw query and returns its result rows, normalized from the driver's shape into a plain array. See OrmDatabase.executeRows.

  • find(metadata: OrmTableMetadata, options?: OrmFindOptionsMany<EntityType>): Promise<(OrmRawData<EntityType>)[]>

  • findAndCount(metadata: OrmTableMetadata, options?: OrmFindOptionsMany<EntityType>): Promise<[(OrmRawData<EntityType>)[], number]>

  • findOne(metadata: OrmTableMetadata, options?: OrmFindOptions<EntityType>): Promise<OrmRawData<EntityType> | null>

  • increment(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>, column: keyof EntityType & string, value: number, additionalSet?: Record<string, unknown>): Promise<OrmUpdateResult<EntityType>>

  • insert(metadata: OrmTableMetadata, values: readonly (Partial<Pick<EntityType, NonFnKeys<EntityType>>>)[]): Promise<OrmInsertResult<EntityType>>

  • safeBatchSize(columnCount: number): number

    Returns the largest chunk size that keeps a single statement's bound parameters under this.maxSQLVariables, with a 10% headroom for other parameters in the same query. Pass 1 for a list of scalar IDs.

  • timeSeries(tableName: string, column: string, options: OrmTimeSeriesOptions<object>): Promise<OrmTimeSeriesResult[]>

  • transaction(context: OrmDatabaseImpl, callback: (tx: OrmTransaction) => Promise<T>): Promise<T>

    Interactive read-write transaction. Throws on adapters where supportsInteractiveTransactions === false (D1). For portable atomic writes, use writeBatch.

  • truncate(metadata: OrmTableMetadata): Promise<OrmDeleteResult<EntityType>>

  • update(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>, values: OrmPartialEntity<EntityType>): Promise<OrmUpdateResult<EntityType>>

  • updateBatch(metadata: OrmTableMetadata, operations: readonly ({ conditions: OrmPartialEntity<EntityType>; values: OrmPartialEntity<EntityType> })[]): Promise<OrmUpdateResult<EntityType>>

  • upsert(metadata: OrmTableMetadata, conditions: OrmPartialEntity<EntityType>, values: OrmPartialEntity<EntityType>): Promise<OrmInsertResult<EntityType>>

    Native upsert — single atomic statement using the dialect's conflict resolution syntax (ON CONFLICT DO UPDATE on SQLite/Postgres, ON DUPLICATE KEY UPDATE on MySQL). The dialect-specific work lives in upsertBatch; this is the single-row convenience wrapper.

    conditions holds the entity's identifying fields (typically the primary key). It's not a where clause — there's no read involved.

  • upsertBatch(metadata: OrmTableMetadata, operations: readonly ({ conditions: OrmPartialEntity<EntityType>; values: OrmPartialEntity<EntityType> })[]): Promise<OrmInsertResult<EntityType>>

  • writeBatch(operations: readonly OrmBatchOperation[]): Promise<OrmBatchResult>

    Atomic batch of write operations. Default impl wraps the operations in a Drizzle transaction; D1 overrides to use db.batch([...]) since it has no transaction support. Either way, all operations commit together or none do.

View source ↗

SQLite dialect base. Concrete drivers (D1, Durable Objects, BetterSQLite) extend this for their connection setup, transaction model, and result conversion. Shared CRUD lives on DrizzleAdapterBase; only operations that need the SQLite variable-limit batching, the ON CONFLICT upsert syntax, or SQLite-specific strftime/datetime time bucketing live here.

extends SQLiteAdapter · implements OrmDurableAdapter

Members

  • adapterType: "drizzle"

  • databaseType: { dialect: "sqlite"; driver: "d1" | "durable" | "better-sqlite" }

  • supportsInteractiveTransactions: boolean

    Default: every Drizzle adapter except D1 can wrap writeBatch in a native transaction. D1 overrides this to false (only supports db.batch(), which writeBatch maps to natively).

  • count(metadata: OrmTableMetadata, options?: OrmFindOptionsMany<EntityType>): Promise<number>

  • decrement(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>, column: keyof EntityType & string, value: number, additionalSet?: Record<string, unknown>): Promise<OrmUpdateResult<EntityType>>

  • delete(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>): Promise<OrmDeleteResult<EntityType>>

  • deleteBatch(metadata: OrmTableMetadata, conditions: readonly (Partial<Pick<EntityType, NonFnKeys<EntityType>>>)[]): Promise<OrmDeleteResult<EntityType>>

  • dispose(): Promise<void>

  • execute(query: string | SQLWrapper): Promise<any>

  • executeRows(query: string | SQLWrapper): Promise<RowType[]>

    Runs a raw query and returns its result rows, normalized from the driver's shape into a plain array. See OrmDatabase.executeRows.

  • find(metadata: OrmTableMetadata, options?: OrmFindOptionsMany<EntityType>): Promise<(OrmRawData<EntityType>)[]>

  • findAndCount(metadata: OrmTableMetadata, options?: OrmFindOptionsMany<EntityType>): Promise<[(OrmRawData<EntityType>)[], number]>

  • findOne(metadata: OrmTableMetadata, options?: OrmFindOptions<EntityType>): Promise<OrmRawData<EntityType> | null>

  • getAvailableMigrations(): DrizzleMigrationEntry[]

  • getReleased(): readonly string[]

  • increment(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>, column: keyof EntityType & string, value: number, additionalSet?: Record<string, unknown>): Promise<OrmUpdateResult<EntityType>>

  • insert(metadata: OrmTableMetadata, values: readonly (Partial<Pick<EntityType, NonFnKeys<EntityType>>>)[]): Promise<OrmInsertResult<EntityType>>

  • migrate(): Promise<void>

  • safeBatchSize(columnCount: number): number

    Returns the largest chunk size that keeps a single statement's bound parameters under this.maxSQLVariables, with a 10% headroom for other parameters in the same query. Pass 1 for a list of scalar IDs.

  • timeSeries(tableName: string, column: string, options: OrmTimeSeriesOptions<object>): Promise<OrmTimeSeriesResult[]>

    Builds a time-bucketed histogram with conditional counts using direct aggregation.

    • Uses GROUP BY on time buckets directly from table data.
    • Much faster than CTE + JOIN approach for large datasets.
    • Returns OrmTimeSeriesResult format.
  • transaction(context: OrmDatabaseImpl, callback: (tx: OrmTransaction) => Promise<T>): Promise<T>

    Interactive read-write transaction. Throws on adapters where supportsInteractiveTransactions === false (D1). For portable atomic writes, use writeBatch.

  • truncate(metadata: OrmTableMetadata): Promise<OrmDeleteResult<EntityType>>

  • update(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>, values: OrmPartialEntity<EntityType>): Promise<OrmUpdateResult<EntityType>>

  • updateBatch(metadata: OrmTableMetadata, operations: readonly ({ conditions: OrmPartialEntity<EntityType>; values: OrmPartialEntity<EntityType> })[]): Promise<OrmUpdateResult<EntityType>>

  • upsert(metadata: OrmTableMetadata, conditions: OrmPartialEntity<EntityType>, values: OrmPartialEntity<EntityType>): Promise<OrmInsertResult<EntityType>>

    Native upsert — single atomic statement using the dialect's conflict resolution syntax (ON CONFLICT DO UPDATE on SQLite/Postgres, ON DUPLICATE KEY UPDATE on MySQL). The dialect-specific work lives in upsertBatch; this is the single-row convenience wrapper.

    conditions holds the entity's identifying fields (typically the primary key). It's not a where clause — there's no read involved.

  • upsertBatch(metadata: OrmTableMetadata, operations: readonly ({ conditions: OrmPartialEntity<EntityType>; values: OrmPartialEntity<EntityType> })[]): Promise<OrmInsertResult<EntityType>>

  • writeBatch(operations: readonly OrmBatchOperation[]): Promise<OrmBatchResult>

    The inherited writeBatch wraps the operations in Drizzle's db.transaction, which the durable-sqlite driver implements via workerd's SYNCHRONOUS transactionSync — an async callback escapes it at its first await, the empty transaction commits immediately, and every batched statement then runs auto-committed outside any transaction (op N failing leaves ops 1..N-1 applied). Wrap the batch in the async-safe storage.transaction instead — the same rationale as the transaction() override above: DO storage is one SQLite engine, so SQL issued through this.db inside it is atomic.

View source ↗

implements OrmAdapterProviderDurableSQLite<"drizzle">

Members

View source ↗

MySQL dialect adapter. Driver-specific connection construction (e.g. PlanetScale) lives in the corresponding provider; this class just takes a MySqlDatabase instance and runs queries against it. Shared CRUD lives on DrizzleAdapterBase; the methods here are the ones with dialect-specific semantics (ON DUPLICATE KEY UPDATE upsert) or dialect-specific batching strategies (MySQL's 65K placeholder limit is generous enough that we don't chunk).

extends DrizzleAdapterBase

Members

  • adapterType: "drizzle"

  • databaseType: { dialect: "mysql"; driver: "planetscale" }

  • supportsInteractiveTransactions: boolean

    Default: every Drizzle adapter except D1 can wrap writeBatch in a native transaction. D1 overrides this to false (only supports db.batch(), which writeBatch maps to natively).

  • count(metadata: OrmTableMetadata, options?: OrmFindOptionsMany<EntityType>): Promise<number>

  • decrement(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>, column: keyof EntityType & string, value: number, additionalSet?: Record<string, unknown>): Promise<OrmUpdateResult<EntityType>>

  • delete(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>): Promise<OrmDeleteResult<EntityType>>

  • deleteBatch(metadata: OrmTableMetadata, conditions: readonly (Partial<Pick<EntityType, NonFnKeys<EntityType>>>)[]): Promise<OrmDeleteResult<EntityType>>

  • dispose(): Promise<void>

  • execute(query: string | SQLWrapper): Promise<any>

  • executeRows(query: string | SQLWrapper): Promise<RowType[]>

    Runs a raw query and returns its result rows, normalized from the driver's shape into a plain array. See OrmDatabase.executeRows.

  • find(metadata: OrmTableMetadata, options?: OrmFindOptionsMany<EntityType>): Promise<(OrmRawData<EntityType>)[]>

  • findAndCount(metadata: OrmTableMetadata, options?: OrmFindOptionsMany<EntityType>): Promise<[(OrmRawData<EntityType>)[], number]>

  • findOne(metadata: OrmTableMetadata, options?: OrmFindOptions<EntityType>): Promise<OrmRawData<EntityType> | null>

  • increment(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>, column: keyof EntityType & string, value: number, additionalSet?: Record<string, unknown>): Promise<OrmUpdateResult<EntityType>>

  • insert(metadata: OrmTableMetadata, values: readonly (Partial<Pick<EntityType, NonFnKeys<EntityType>>>)[]): Promise<OrmInsertResult<EntityType>>

  • safeBatchSize(columnCount: number): number

    Returns the largest chunk size that keeps a single statement's bound parameters under this.maxSQLVariables, with a 10% headroom for other parameters in the same query. Pass 1 for a list of scalar IDs.

  • timeSeries(tableName: string, column: string, options: OrmTimeSeriesOptions<object>): Promise<OrmTimeSeriesResult[]>

    Builds a time-bucketed histogram with optional conditional counts, using MySQL date functions. Mirrors the SQLite adapter's behavior with DATE_FORMAT/FROM_UNIXTIME in place of strftime. Supports COUNT(DISTINCT <column>) per bucket via options.distinctColumn.

  • transaction(context: OrmDatabaseImpl, callback: (tx: OrmTransaction) => Promise<T>): Promise<T>

    Interactive read-write transaction. Throws on adapters where supportsInteractiveTransactions === false (D1). For portable atomic writes, use writeBatch.

  • truncate(metadata: OrmTableMetadata): Promise<OrmDeleteResult<EntityType>>

  • update(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>, values: OrmPartialEntity<EntityType>): Promise<OrmUpdateResult<EntityType>>

  • updateBatch(metadata: OrmTableMetadata, operations: readonly ({ conditions: OrmPartialEntity<EntityType>; values: OrmPartialEntity<EntityType> })[]): Promise<OrmUpdateResult<EntityType>>

  • upsert(metadata: OrmTableMetadata, conditions: OrmPartialEntity<EntityType>, values: OrmPartialEntity<EntityType>): Promise<OrmInsertResult<EntityType>>

    Native upsert — single atomic statement using the dialect's conflict resolution syntax (ON CONFLICT DO UPDATE on SQLite/Postgres, ON DUPLICATE KEY UPDATE on MySQL). The dialect-specific work lives in upsertBatch; this is the single-row convenience wrapper.

    conditions holds the entity's identifying fields (typically the primary key). It's not a where clause — there's no read involved.

  • upsertBatch(metadata: OrmTableMetadata, operations: readonly ({ conditions: OrmPartialEntity<EntityType>; values: OrmPartialEntity<EntityType> })[]): Promise<OrmInsertResult<EntityType>>

  • writeBatch(operations: readonly OrmBatchOperation[]): Promise<OrmBatchResult>

    Atomic batch of write operations. Default impl wraps the operations in a Drizzle transaction; D1 overrides to use db.batch([...]) since it has no transaction support. Either way, all operations commit together or none do.

View source ↗

A base class for entities that tracks changes to fields.

extends OrmTrackingEntity

Members

  • createdAt: Date

  • id: string

  • clone(): T

  • getChangedFields(): OrmPartialEntity<this>

  • toJSON(options?: { strict?: boolean }): Dictionary<unknown>

  • static from(this: () => T, data: OrmPartialEntity<T>): T

    Create a new instance of the entity with the given data.

View source ↗

Members

  • getDatabase(token?: InjectionToken, requestingClass?: Constructor): OrmDatabase

    Resolves the OrmDatabase for an injection site.

    Database selection precedence:

    1. an explicit token (a DatabaseBinding/key passed to the decorator) — always wins;
    2. otherwise the requestingClass's declared module membership (@Injectable(SomeModuleKey), @WorkerScoped(SomeModuleKey), …) — resolved through the module graph, so the worker's database registration modifier applies;
    3. otherwise the default database — a uniform contract in every worker. Registration never routes injections; boot validation rejects a non-default-database module's class with token-less injections that forgot to declare (see BaseConfiguration.getDatabaseNameForClass).

View source ↗

A write batch that can be built up across async code before it is executed.

OrmDatabase.writeBatch takes a synchronous builder callback, which works when all the decisions are made up front. Flows that interleave reads with queued writes (read an entity, decide, queue an update, read some more) can't build inside that callback. This class is the bridge: it implements OrmDatabaseBatch, so it can be threaded through service methods exactly like a batch, queueing operations with no I/O. commit(db) then replays the queued operations into one atomic writeBatch and runs any registered onSuccess callbacks.

Because nothing executes until commit, all reads naturally happen before the batch — the reads-first pattern that keeps modules portable to batch-only backends like D1. Note that auto-generated ids are assigned when the batch executes, not when an insert is queued; assign ids explicitly before queueing if they are needed earlier.

onSuccess callbacks run sequentially after the batch commits — use them for side effects that must not happen if the writes fail (sending emails, setting cookies).

implements OrmDatabaseBatch

Members

  • hasOperations: boolean

    Whether any write operations have been queued.

  • commit(database: OrmDatabase): Promise<OrmBatchResult>

    Executes the queued operations as one atomic writeBatch against the provided database, then runs the onSuccess callbacks in registration order. A batch can only be committed once.

  • delete(entity: EntityType | readonly EntityType[]): void

  • deleteWhere(target: Constructor<EntityType>, conditions: OrmFindOptionsWhere<EntityType>): void

    Queue a delete by arbitrary conditions (the batch counterpart of OrmDatabase.delete(target, conditions)). No entity lifecycle hooks run because no entity instances are involved.

  • execute(query: string | SQLWrapper): void

    Queue a raw write statement (built with the drizzle sql template) to run inside the same atomic batch — the escape hatch for bulk updates the entity API can't express (computed SET clauses, conditional shifts, increments). No entity lifecycle hooks run for it.

  • insert(entity: EntityType | readonly EntityType[]): void

  • onSuccess(callback: () => void | Promise<void>): void

    Registers a callback to run after the batch commits successfully.

  • update(entity: EntityType | readonly EntityType[]): void

  • upsert(entity: EntityType | readonly EntityType[]): void

View source ↗

Members

  • static applyTransformersToDatabase(data: T, metadata: OrmTableMetadata): T

    Applies value transformers when preparing data for database This should be called before insert/update operations

  • static hydrateMany(raw: unknown[], target: Constructor<T>, options: HydrationOptions): T[]

    Hydrates an array of raw objects into entity instances

  • static hydrateOne(raw: unknown, target: Constructor<T>, options: HydrationOptions): T | null

    Hydrates a single raw object into an entity instance

View source ↗

A base class for entities that tracks changes to fields.

extends OrmBaseEntity

Members

  • createdAt: Date

  • id: string

  • updatedAt: Date

  • hasBeenUpdated: boolean

    Whether this row has been updated since it was created.

    updatedAt is initialized to the same instant as createdAt on insert, then bumped on every update — so the row has never been updated exactly when updatedAt === createdAt. (This replaces the old "updatedAt is null" sentinel, which couldn't work on backends where the column is NOT NULL.)

  • clone(): T

  • getChangedFields(): OrmPartialEntity<this>

  • toJSON(options?: { strict?: boolean }): Dictionary<unknown>

  • static from(this: () => T, data: OrmPartialEntity<T>): T

    Create a new instance of the entity with the given data.

View source ↗

Pagination + filter input for the Orm find layer. NOT a GraphQL wire type: resolvers receive the wire PaginationInput (or a @PaginationInputFor subclass) and it is bridged here — automatically by ormPaginatedFind, or explicitly via OrmPaginationInput.from(...) when the resolver needs scopeWhere/narrowing before the find.

Members

  • filters?: ColumnFilterInput[]

  • itemIndex?: number

  • itemsPerPage: number

  • orderBy?: OrderByInput[]

  • addFilter(filter: ColumnFilterInput): void

  • addFindOptionsOrder(findOptions: OrmFindOptionsOrder<Entity>): void

  • addOrderBy(orderBy: OrderByInput): void

  • allowFilterColumns(columns: readonly string[]): this

    Opt in to client-supplied column filters for a fixed set of columns.

    Fail closed: until a resolver calls this, any client filters are REJECTED with an ArgumentValidationError — a query can never be filter-injected on a column the server didn't explicitly expose, and a filter the server won't honor is never silently dropped (which would over-return rows the client asked to exclude). Once an allowlist is set, a client filter naming a column outside it throws rather than being silently applied or silently dropped.

    This is the deliberate, narrow seam for exposing client-driven filtering. Server-mandated conditions still go through scopeWhere and always win over client filters.

    On an input declared with @PaginationInputFor, this may only NARROW the declared set — the declaration is the outer bound of what the type exposes, and widening past it here would silently contradict the schema.

  • allowOrderColumns(columns: readonly string[]): this

    Opt in to client-supplied ordering for a fixed set of columns. Same contract as allowFilterColumns: until set (directly or via a @PaginationInputFor declaration), client orderBy is REJECTED — an unvetted sort column is an unindexed-sort surface, so the columns listed here are a statement that the query was planned for them. On a declared input, this may only narrow the declared set.

  • getFindOptionsOrder(): Partial<Record<never, "ASC" | "DESC">> | undefined

  • getFindOptionsWhere(): object | undefined

  • scopeWhere(conditions: OrmFindOptionsWhere<Entity>): void

    Adds server-mandated scope conditions to the query.

    Scope conditions are AND'd with the client-supplied filters and ALWAYS win on key collision — a client filter can never override or drop a scope condition. Use this for every condition the server requires (owner scoping, status gates, tenant boundaries).

    Multiple calls AND-merge; a later call wins over an earlier one on the same key.

  • static from(pagination: { filters?: ColumnFilterInput[]; itemIndex?: number; itemsPerPage: number; orderBy?: OrderByInput[] }): OrmPaginationInput

    Creates an OrmPaginationInput from any pagination-shaped input — typically the GraphQL wire PaginationInput a resolver received.

    When the input is an instance of a @PaginationInputFor-declared class, its declared filter/order allowlists are applied automatically — the declaration on the input type is the single statement of what clients may filter and order by.

View source ↗

Members

  • db: OrmDatabaseImpl<OrmSettings<"drizzle">>

  • target: Constructor<EntityType>

  • tableName: string

  • count(options?: OrmFindOptionsMany<EntityType>): Promise<number>

    Counts entities that match given options. Useful for pagination.

  • decrement(conditions: OrmFindOptionsWhere<EntityType>, column: keyof EntityType & string, value: number): Promise<OrmUpdateResult<EntityType>>

    Atomically decrements a numeric column value.

  • delete(entity: Readonly<EntityType>): Promise<OrmDeleteResult<EntityType>>

    delete(entity: readonly EntityType[]): Promise<OrmDeleteResult<EntityType>>

  • find(options?: OrmFindOptionsMany<EntityType>): Promise<EntityType[]>

    Finds entities that match given find options.

  • findAndCount(options?: OrmFindOptionsMany<EntityType>): Promise<[EntityType[], number]>

    Finds entities that match given find options. Also counts all entities that match given conditions, but ignores pagination settings (from and take options).

  • findOne(options?: OrmFindOptions<EntityType>): Promise<EntityType | null>

    Finds first entity by a given find options. If entity was not found in the database - returns null.

  • increment(conditions: OrmFindOptionsWhere<EntityType>, column: keyof EntityType & string, value: number): Promise<OrmUpdateResult<EntityType>>

    Atomically increments a numeric column value.

  • insert(entity: Readonly<EntityType>): Promise<OrmInsertResult<EntityType>>

    insert(entity: readonly EntityType[]): Promise<OrmInsertResult<EntityType>>

  • safeBatchSize(columnCount: number): Promise<number>

    Returns the largest chunk size that keeps a single statement's bound parameters under the underlying adapter's safe limit. Use this when chunking a large input array in caller code (e.g. for an IN (...) filter or a batched read). Pass 1 for a list of scalar IDs.

  • timeSeries(column: OrmEntityKey<EntityType>, options: OrmTimeSeriesOptions<EntityType>): Promise<OrmTimeSeriesResult[]>

  • truncate(_options: { confirm: true }): Promise<OrmDeleteResult<EntityType>>

    Deletes every row in the table.

    Requires the target entity to be marked truncatable: true via @OrmTable({ truncatable: true }). Tables that are not explicitly marked as truncatable will throw at runtime.

    The confirm: true flag must be passed at every call site to make the intent visible in code review — this method cannot be called without spelling out that a full-table wipe is intended.

  • update(entity: Readonly<EntityType>): Promise<OrmUpdateResult<EntityType>>

    update(entity: readonly EntityType[]): Promise<OrmUpdateResult<EntityType>>

  • upsert(entity: Readonly<EntityType>): Promise<OrmInsertResult<EntityType>>

    upsert(entity: readonly EntityType[]): Promise<OrmInsertResult<EntityType>>

  • writeBatch(build: (batch: OrmRepositoryBatch<EntityType>) => void): Promise<OrmBatchResult>

    Atomically execute a batch of writes against this repository's entity. The build callback receives a builder that mirrors the repo's insert/update/upsert/delete methods but queues operations instead of executing them. Submitted as one atomic batch — D1 maps it to db.batch([...]), other adapters use a native transaction.

    Portable across all adapters. The recommended primitive for atomic writes that need to work the same regardless of which database backs the deployment.

View source ↗

Implementation of OrmRepositoryBatch. Public-ish — both OrmRepository.writeBatch and OrmDatabase.writeBatch instantiate this. Holds a reference to a shared operations queue (so multi-entity batches preserve call order across entity types) and tracks the affected entities so after-hooks can fire once the batch resolves.

implements OrmRepositoryBatch<EntityType>

Members

  • operations: OrmBatchOperation[]

  • delete(entity: EntityType | readonly EntityType[]): void

  • insert(entity: EntityType | readonly EntityType[]): void

  • runAfterHooks(): void

  • update(entity: EntityType | readonly EntityType[]): void

  • upsert(entity: EntityType | readonly EntityType[]): void

View source ↗

implements OrmSchemaBuilder

Members

  • dialectImportPath: string

    Drizzle import specifier — 'drizzle-orm/sqlite-core' or 'drizzle-orm/mysql-core'. Subclasses override.

  • tableHelperName: string

    Helper function name used to construct tables — 'sqliteTable' or 'mysqlTable'. Subclasses override.

  • createBigIntColumn(name: string, meta: OrmColumnMetadata & { type: { increment?: boolean; kind: "bigint"; mode: "number" | "bigint"; unsigned?: boolean } }): DrizzleEmitted

  • createBooleanColumn(name: string, meta: OrmColumnMetadata & { type: { kind: "boolean" } }): DrizzleEmitted

  • createBytesColumn(name: string, meta: OrmColumnMetadata & { type: { fixed?: boolean; kind: "bytes"; size: number } }): DrizzleEmitted

  • createCharColumn(name: string, meta: OrmColumnMetadata & { type: { kind: "char"; length: number } }): DrizzleEmitted

  • createDatetimeColumn(name: string, meta: OrmColumnMetadata & { type: { fsp?: DatetimeFsp; kind: "datetime"; mode: "string" | "date" } }): DrizzleEmitted

  • createDecimalColumn(name: string, meta: OrmColumnMetadata & { type: { kind: "decimal"; mode: "string" | "number" | "bigint"; precision?: number; scale?: number; unsigned?: boolean } }): DrizzleEmitted

  • createDialectTable(name: string, columns: Record<string, any>, constraints?: (table: any) => any[]): any

  • createDoubleColumn(name: string, meta: OrmColumnMetadata & { type: { kind: "double"; precision?: number; scale?: number; unsigned?: boolean } }): DrizzleEmitted

  • createEnumColumn(name: string, meta: OrmColumnMetadata & { type: { kind: "enum"; values: string[] | Dictionary<unknown> } }): DrizzleEmitted

  • createFloatColumn(name: string, meta: OrmColumnMetadata & { type: { kind: "float"; precision?: number; scale?: number; unsigned?: boolean } }): DrizzleEmitted

  • createIndex(name: string, columns: OrmSchemaBuilderDrizzleColumns): DrizzleEmitted

  • createIntegerColumn(name: string, meta: OrmColumnMetadata & { type: { increment?: boolean; kind: "integer"; size?: "int8" | "int16" | "int24" | "int32"; unsigned?: boolean } }): DrizzleEmitted

  • createJsonColumn(name: string, meta: OrmColumnMetadata & { type: { kind: "json" } }): DrizzleEmitted

  • createPrimaryKeyConstraint(config: { columns: OrmSchemaBuilderDrizzleColumns; name?: string }): DrizzleEmitted

  • createSchema(entities: OrmTableMetadata[]): Record<string, any>

  • createTextColumn(name: string, meta: OrmColumnMetadata & { type: { kind: "text"; size?: OrmTextSizeType } }): DrizzleEmitted

  • createUniqueConstraint(name: string | undefined, columns: OrmSchemaBuilderDrizzleColumns): DrizzleEmitted

  • createUniqueIndex(name: string, columns: OrmSchemaBuilderDrizzleColumns): DrizzleEmitted

  • createUuidColumn(name: string, meta: OrmColumnMetadata & { type: { generate?: boolean; kind: "uuid" } }): DrizzleEmitted

  • createVarcharColumn(name: string, meta: OrmColumnMetadata & { type: { kind: "varchar"; length: number } }): DrizzleEmitted

  • getEmittedSource(): string

    After createSchema() runs, returns the assembled pure-drizzle source representation of the same schema. Used by the CLI to write schema.generated.ts — drizzle-kit then reads the file directly with no foundation dependency in its loader path.

    Includes the dialect-specific import line (sqlite-core or mysql-core) trimmed to only the helpers actually referenced by the generated tables.

    Relations and join-table relations are intentionally NOT emitted: drizzle-kit's migration generation only needs table definitions for SQL DDL. Drizzle's relations() are a runtime query-builder concept that don't affect the database schema.

View source ↗

extends OrmSchemaBuilderDrizzle

Members

  • createSchema(entities: OrmTableMetadata[]): Record<string, any>

  • getEmittedSource(): string

    After createSchema() runs, returns the assembled pure-drizzle source representation of the same schema. Used by the CLI to write schema.generated.ts — drizzle-kit then reads the file directly with no foundation dependency in its loader path.

    Includes the dialect-specific import line (sqlite-core or mysql-core) trimmed to only the helpers actually referenced by the generated tables.

    Relations and join-table relations are intentionally NOT emitted: drizzle-kit's migration generation only needs table definitions for SQL DDL. Drizzle's relations() are a runtime query-builder concept that don't affect the database schema.

View source ↗

extends OrmSchemaBuilderDrizzle

Members

  • createSchema(entities: OrmTableMetadata[]): Record<string, any>

  • getEmittedSource(): string

    After createSchema() runs, returns the assembled pure-drizzle source representation of the same schema. Used by the CLI to write schema.generated.ts — drizzle-kit then reads the file directly with no foundation dependency in its loader path.

    Includes the dialect-specific import line (sqlite-core or mysql-core) trimmed to only the helpers actually referenced by the generated tables.

    Relations and join-table relations are intentionally NOT emitted: drizzle-kit's migration generation only needs table definitions for SQL DDL. Drizzle's relations() are a runtime query-builder concept that don't affect the database schema.

View source ↗

Stores a string array as a comma-separated text column, matching the storage format of TypeORM's legacy simple-array column type so existing rows remain readable after the Orm (Drizzle) migration.

implements OrmValueTransformer<string[] | null, string | null>

Members

  • from(value: string | null): string[] | null

    Transforms the value from the database to the entity property. Called during entity hydration.

  • to(value: string[] | null): string | null

    Transforms the value from the entity property to the database. Called during insert/update operations.

View source ↗

A base class for entities that tracks changes to fields.

Members

  • clone(): T

  • getChangedFields(): OrmPartialEntity<this>

  • toJSON(options?: { strict?: boolean }): Dictionary<unknown>

  • static from(this: () => T, data: OrmPartialEntity<T>): T

    Create a new instance of the entity with the given data.

View source ↗

implements OrmAdapterProviderPlanetScale<"drizzle">

Members

View source ↗

SQLite dialect base. Concrete drivers (D1, Durable Objects, BetterSQLite) extend this for their connection setup, transaction model, and result conversion. Shared CRUD lives on DrizzleAdapterBase; only operations that need the SQLite variable-limit batching, the ON CONFLICT upsert syntax, or SQLite-specific strftime/datetime time bucketing live here.

extends DrizzleAdapterBase

Members

  • adapterType: "drizzle"

  • databaseType: { dialect: "sqlite"; driver: "d1" | "durable" | "better-sqlite" }

  • supportsInteractiveTransactions: boolean

    Default: every Drizzle adapter except D1 can wrap writeBatch in a native transaction. D1 overrides this to false (only supports db.batch(), which writeBatch maps to natively).

  • convertDeleteResult(driverResult: any): OrmDeleteResult<EntityType>

    Convert driver-specific delete result to ORM delete result.

  • convertInsertResult(driverResult: any): OrmInsertResult<EntityType>

    Convert driver-specific insert result to ORM insert result.

  • convertUpdateResult(driverResults: any[]): OrmUpdateResult<EntityType>

    Convert driver-specific update result(s) to ORM update result.

  • convertUpsertResult(driverResults: any[]): OrmInsertResult<EntityType>

    Convert driver-specific upsert result(s) to ORM insert result.

  • count(metadata: OrmTableMetadata, options?: OrmFindOptionsMany<EntityType>): Promise<number>

  • decrement(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>, column: keyof EntityType & string, value: number, additionalSet?: Record<string, unknown>): Promise<OrmUpdateResult<EntityType>>

  • delete(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>): Promise<OrmDeleteResult<EntityType>>

  • deleteBatch(metadata: OrmTableMetadata, conditions: readonly (Partial<Pick<EntityType, NonFnKeys<EntityType>>>)[]): Promise<OrmDeleteResult<EntityType>>

  • dispose(): Promise<void>

  • execute(query: string | SQLWrapper): Promise<any>

  • executeRows(query: string | SQLWrapper): Promise<RowType[]>

    Runs a raw query and returns its result rows, normalized from the driver's shape into a plain array. See OrmDatabase.executeRows.

  • find(metadata: OrmTableMetadata, options?: OrmFindOptionsMany<EntityType>): Promise<(OrmRawData<EntityType>)[]>

  • findAndCount(metadata: OrmTableMetadata, options?: OrmFindOptionsMany<EntityType>): Promise<[(OrmRawData<EntityType>)[], number]>

  • findOne(metadata: OrmTableMetadata, options?: OrmFindOptions<EntityType>): Promise<OrmRawData<EntityType> | null>

  • increment(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>, column: keyof EntityType & string, value: number, additionalSet?: Record<string, unknown>): Promise<OrmUpdateResult<EntityType>>

  • insert(metadata: OrmTableMetadata, values: readonly (Partial<Pick<EntityType, NonFnKeys<EntityType>>>)[]): Promise<OrmInsertResult<EntityType>>

  • safeBatchSize(columnCount: number): number

    Returns the largest chunk size that keeps a single statement's bound parameters under this.maxSQLVariables, with a 10% headroom for other parameters in the same query. Pass 1 for a list of scalar IDs.

  • timeSeries(tableName: string, column: string, options: OrmTimeSeriesOptions<object>): Promise<OrmTimeSeriesResult[]>

    Builds a time-bucketed histogram with conditional counts using direct aggregation.

    • Uses GROUP BY on time buckets directly from table data.
    • Much faster than CTE + JOIN approach for large datasets.
    • Returns OrmTimeSeriesResult format.
  • transaction(context: OrmDatabaseImpl, callback: (tx: OrmTransaction) => Promise<T>): Promise<T>

    Interactive read-write transaction. Throws on adapters where supportsInteractiveTransactions === false (D1). For portable atomic writes, use writeBatch.

  • truncate(metadata: OrmTableMetadata): Promise<OrmDeleteResult<EntityType>>

  • update(metadata: OrmTableMetadata, conditions: OrmFindOptionsWhere<EntityType>, values: OrmPartialEntity<EntityType>): Promise<OrmUpdateResult<EntityType>>

  • updateBatch(metadata: OrmTableMetadata, operations: readonly ({ conditions: OrmPartialEntity<EntityType>; values: OrmPartialEntity<EntityType> })[]): Promise<OrmUpdateResult<EntityType>>

  • upsert(metadata: OrmTableMetadata, conditions: OrmPartialEntity<EntityType>, values: OrmPartialEntity<EntityType>): Promise<OrmInsertResult<EntityType>>

    Native upsert — single atomic statement using the dialect's conflict resolution syntax (ON CONFLICT DO UPDATE on SQLite/Postgres, ON DUPLICATE KEY UPDATE on MySQL). The dialect-specific work lives in upsertBatch; this is the single-row convenience wrapper.

    conditions holds the entity's identifying fields (typically the primary key). It's not a where clause — there's no read involved.

  • upsertBatch(metadata: OrmTableMetadata, operations: readonly ({ conditions: OrmPartialEntity<EntityType>; values: OrmPartialEntity<EntityType> })[]): Promise<OrmInsertResult<EntityType>>

  • writeBatch(operations: readonly OrmBatchOperation[]): Promise<OrmBatchResult>

    Atomic batch of write operations. Default impl wraps the operations in a Drizzle transaction; D1 overrides to use db.batch([...]) since it has no transaction support. Either way, all operations commit together or none do.

View source ↗

Classes • Documentation • Base