本页还没有译文
本页 24 段还没译成Español,下面显示的是英文原文。SerializerConfig
还没翻译译自英文(tanstack.com)本页 24 段都还没译
type SerializerConfig<TOutput, TSQLite> = object;Defined in: definitions.ts:65
Type Parameters
TOutput
TOutput extends Record<string, unknown>
TSQLite
TSQLite extends Record<string, unknown>
Properties
onDeserializationError()
onDeserializationError: (error) => void;Defined in: definitions.ts:98
Application logic should ensure that incoming synced data is always valid. Failing to deserialize and apply incoming changes results in data inconsistency - which is a fatal error. Use this callback to react to deserialization errors.
Parameters
error
StandardSchemaV1.FailureResult
Returns
void
serializer?
optional serializer: CustomSQLiteSerializer<TOutput, TSQLite>;Defined in: definitions.ts:91
Optional partial serializer object for customizing how individual columns are serialized for SQLite.
This should be a partial map of column keys to serialization functions, following the CustomSQLiteSerializer type. Each function receives the column value and returns a value compatible with SQLite storage.
If not provided for a column, the default behavior is used:
TEXT: Strings are stored as-is; Dates are converted to ISO strings; other types are JSON-stringified.INTEGER/REAL: Numbers are stored as-is; booleans are mapped to 1/0.
Use this option to override serialization for specific columns, such as formatting dates, handling enums, or serializing complex objects.
Example:
serializer: {
createdAt: (date) => date.getTime(), // Store as timestamp
meta: (meta) => JSON.stringify(meta), // Custom object serialization
}