Skip to main content

Function: convertToDbValue()

function convertToDbValue(value: unknown): DbValue | undefined;

Defined in: electron/services/database/utils/converters/valueConverters.ts:41

Converts an unknown input to a SQLite-bindable DbValue.

Parameters

value

unknown

Returns

DbValue | undefined

Remarks

  • Finite number and string values pass through
  • boolean becomes 1/0
  • null becomes null
  • Non-finite numbers, undefined, and all other types return undefined (caller decides whether to skip the field or coerce to null)

Prefer this helper instead of ad-hoc typeof chains so the conversion rules stay consistent across repositories and mappers.