Skip to content

deserializeRow

deserializeRow<Desc>(schema, row, columnMap?, columns?): MessageShape<Desc>

Defined in: serialization.ts:121

Convert a plain database row object into a protobuf message. Database column names are mapped back to proto JSON field names, then @bufbuild/protobuf’s fromJson handles type conversion (strings back to bigints, RFC 3339 to Timestamps, etc.).

Boolean fields are coerced from integers (0/1) to booleans, since databases like SQLite lack a native boolean type.

When a columns config is provided:

  • Fields with ignore: true are skipped (they get proto3 defaults).
  • Fields with serialize: "json" are parsed from JSON strings via fromJsonString.
  • Fields with serialize: "binary" are parsed from Uint8Array via fromBinary.

Desc extends DescMessage

Desc

The message descriptor.

Record<string, unknown>

The database row as a plain object.

Record<string, string>

Map of proto field names (snake_case) to database column names.

Record<string, ColumnConfig>

Per-field column configuration.

MessageShape<Desc>