DbCodec
A value type the db stores as tagged JSON, beyond the ones it knows
Import
import { DbCodec } from "@hyper-fetch/db"
Source
Package
Preview
type DbCodec = {
decode: (value: unknown) => unknown;
encode: (value: unknown) => unknown;
name: string;
test: (value: unknown) => boolean;
}
Structure
DbCodec
| Name | Type | Description |
|---|---|---|
| name | | The tag stored with encoded values. It must stay the same across releases. |
| decode | | Turns a stored value back |
| encode | | Turns a value into one the serializer can store |
| test | | Whether a value is of this type |
