Skip to content

egon-orm-workspace / egon-orm / Codec

Interface: Codec ​

Defined in: core/src/contracts/type.ts:214

A pair of driver conversions: what an adapter supplies to override a type's own fromDb/toDb for its dialect, and what resolveCodec (step 03) returns. Either member may be IDENTITY.

Example ​

ts
// Postgres sends int8 as text; read it as a bigint.
const int8: Codec = { fromDb: (text) => BigInt(text as string), toDb: IDENTITY };

Properties ​

fromDb ​

ts
readonly fromDb: (value) => unknown;

Defined in: core/src/contracts/type.ts:216

Driver value to application value. Never called with null.

Parameters ​

value ​

unknown

Returns ​

unknown


toDb ​

ts
readonly toDb: (value) => unknown;

Defined in: core/src/contracts/type.ts:218

Application value to driver parameter. Never called with null.

Parameters ​

value ​

unknown

Returns ​

unknown