Funcs to convert between Nim types and SQLite types and between Nim values and lowdb.postgres.DbValue.

To add support for YourType, define three funcs:

  • dbType(T: typedesc[YourType]) -> string that returns SQL type for given YourType
  • dbValue(YourType) -> DbValue that converts instances of YourType to lowdb.sqlite.DbValue
  • to(DbValue, T: typedesc[YourType]) -> T that converts lowdb.sqlite.DbValue instances to YourType.


func dbType(T: typedesc[bool]): string
func dbType(T: typedesc[DateTime]): string
func dbType(T: typedesc[float32]): string
func dbType(T: typedesc[float64]): string
func dbType(T: typedesc[int16]): string
func dbType(T: typedesc[int32 | enum]): string
func dbType(T: typedesc[int64 | Positive | int | Natural]): string
func dbType(T: typedesc[Model]): string
func dbType(T: typedesc[string]): string
func dbType[C](_: typedesc[PaddedStringOfCap[C]]): string
func dbType[C](_: typedesc[StringOfCap[C]]): string
func dbType[T](_: typedesc[Option[T]]): string
func dbValue(val: typeof(nil)): DbValue {....raises: [], tags: [].}
func dbValue[T: Model](val: Option[T]): DbValue
func dbValue[T: Model](val: T): DbValue
func dbValue[T](val: PaddedStringOfCap[T]): DbValue
func dbValue[T](val: StringOfCap[T]): DbValue
func to(dbVal; T: typedesc[bool]): T:type
func to(dbVal; T: typedesc[DateTime]): T:type
func to(dbVal; T: typedesc[Model]): T:type
This is never called and exists only to please the compiler.
func to(dbVal; T: typedesc[SomeFloat]): T:type
func to(dbVal; T: typedesc[SomeInteger | enum]): T:type
func to(dbVal; T: typedesc[string]): T:type
func to[T1](dbVal; T2: typedesc[PaddedStringOfCap[T1]]): T2:type
func to[T1](dbVal; T2: typedesc[StringOfCap[T1]]): T2:type
proc to[T](dbVal; O: typedesc[Option[T]]): O:type