Open History to see the last commit
Function: electricCollectionOptions()#
function electricCollectionOptions<TExplicit, TSchema, TFallback>(config): object
Defined in: packages/electric-db-collection/src/electric.ts:285
Creates Electric collection options for use with a standard Collection
Type Parameters#
• TExplicit extends Row<unknown> = Row<unknown>
The explicit type of items in the collection (highest priority)
• TSchema extends StandardSchemaV1<unknown, unknown> = never
The schema type for validation and type inference (second priority)
• TFallback extends Row<unknown> = Row<unknown>
The fallback type if no explicit or schema type is provided
Parameters#
config#
ElectricCollectionConfig<TExplicit, TSchema, TFallback>
Configuration options for the Electric collection
Returns#
object
Collection options with utilities
getKey()#
getKey: (item) => string | number;
Parameters#
item#
ResolveType
Returns#
string | number
id?#
optional id: string;
All standard Collection configuration properties
onDelete#
onDelete:
| undefined
| (params) => Promise<{
txid: number | number[];
}> = wrappedOnDelete;
onInsert#
onInsert:
| undefined
| (params) => Promise<{
txid: number | number[];
}> = wrappedOnInsert;
onUpdate#
onUpdate:
| undefined
| (params) => Promise<{
txid: number | number[];
}> = wrappedOnUpdate;
schema?#
optional schema: TSchema;
sync#
sync: SyncConfig<ResolveType<TExplicit, TSchema, TFallback>, string | number>;
utils#
utils: object;
utils.awaitTxId#
awaitTxId: AwaitTxIdFn;