Skip to main content

Function: convertToDbValue()

convertToDbValue(value: unknown): DbValue | undefined

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

Converts an unknown input to a SQLite-bindable DbValue.

Parameters

value

unknown

Returns

DbValue | undefined

Remarks

string and number pass through

  • boolean becomes 1/0
  • null becomes null
  • 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.