File: CustomSQLiteSerializer.md | Updated: 11/15/2025
Search...
+ K
Auto
Docs Examples GitHub Contributors
Docs Examples GitHub Contributors
Docs Examples GitHub Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Maintainers Partners Support Learn StatsBETA Discord Merch Blog GitHub Ethos Brand Guide
Documentation
Framework
React
Version
Latest
Search...
+ K
Menu
Getting Started
Guides
Collections
Frameworks
Community
API Reference
Framework
React
Version
Latest
Menu
Getting Started
Guides
Collections
Frameworks
Community
API Reference
On this page
Copy Markdown
ts
type CustomSQLiteSerializer<TOutput, TSQLite> = Partial<{ [Key in keyof TOutput]: (value: TOutput[Key]) => Key extends keyof TSQLite ? TSQLite[Key] : never }>;
type CustomSQLiteSerializer<TOutput, TSQLite> = Partial<{ [Key in keyof TOutput]: (value: TOutput[Key]) => Key extends keyof TSQLite ? TSQLite[Key] : never }>;
Defined in: definitions.ts:52
A mapping type for custom serialization of object properties to SQLite-compatible values.
This type allows you to override, for keys in the input object (TOutput), a function that transforms the value to the corresponding SQLite type (TSQLite). Keys not specified will use the default SQLite serialization.
Use this type to define a map of serialization functions for specific keys when you need custom handling (e.g., converting complex objects, formatting dates, or handling enums).
Example:
ts
const serializer: CustomSQLiteSerializer<MyRowType, MySQLiteType> = {
createdAt: (date) => date.toISOString(),
status: (status) => status ? 1 : 0,
meta: (meta) => JSON.stringify(meta),
};
const serializer: CustomSQLiteSerializer<MyRowType, MySQLiteType> = {
createdAt: (date) => date.toISOString(),
status: (status) => status ? 1 : 0,
meta: (meta) => JSON.stringify(meta),
};
Type Parameters
---------------
### TOutput
TOutput extends Record<string, unknown>
TSQLite extends Record<string, unknown>
