interface CustomDatabaseOptions
Since 0.2.0

The arm supplying an externally-implemented backend.

adapter is required by the union, so a 'custom' registration that forgets it is a compile error rather than a startup throw.

Examples

Example 1

import { D1Adapter } from '@setu-ts/cloudflare-plugin';

app.register(DatabasePlugin({
  type: 'custom',
  adapter: new D1Adapter(env.DB as ID1Database),
}));

Properties

readonly
type: "custom"

Selects the external-adapter arm.

Since 0.2.0
readonly
adapter: IDatabaseAdapter

The backend to use, already constructed. The plugin calls connect() on it during register() and disconnect() during shutdown; it never constructs or replaces it.

Usage

import { type CustomDatabaseOptions } from "database-plugin/src/index.ts";