Funcs to convert between Nim types and SQLite types and between Nim values and ndb.sqlite.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 ndb.sqlite.DbValue
  • to(DbValue, T: typedesc[YourType]) -> T that converts ndb.sqlite.DbValue instances to YourType.


proc to(dbVal; T: typedesc[DateTime]): T:type
proc to[T](dbVal; O: typedesc[Option[T]]): O:type


func dbType(T: typedesc[SomeInteger]): string
func dbType(T: typedesc[SomeFloat]): string
func dbType(T: typedesc[string]): string
func dbType(T: typedesc[bool]): string
func dbType(T: typedesc[DbBlob]): string
func dbType(T: typedesc[DateTime]): string
func dbType(T: typedesc[Model]): string
func dbType[C](_: typedesc[StringOfCap[C]]): string
func dbType[C](_: typedesc[PaddedStringOfCap[C]]): string
func dbType[T](_: typedesc[Option[T]]): string
func dbValue(val: bool): DbValue {...}{.raises: [], tags: [].}
func dbValue(val: DateTime): DbValue {...}{.raises: [], tags: [].}
func dbValue[T: Model](val: T): DbValue
func dbValue[_](val: StringOfCap[_]): DbValue
func dbValue[_](val: PaddedStringOfCap[_]): DbValue
func dbValue(val: Option[bool]): DbValue {...}{.raises: [], tags: [].}
func dbValue(val: Option[DateTime]): DbValue {...}{.raises: [], tags: [].}
func dbValue[T: Model](val: Option[T]): DbValue
func to(dbVal; T: typedesc[SomeInteger]): T:type
func to(dbVal; T: typedesc[SomeFloat]): T:type
func to(dbVal; T: typedesc[string]): T:type
func to(dbVal; T: typedesc[bool]): T:type
func to(dbVal; T: typedesc[DbBlob]): T:type
func to[_](dbVal; T: typedesc[StringOfCap[_]]): T:type
func to[_](dbVal; T: typedesc[PaddedStringOfCap[_]]): T:type
func to(dbVal; T: typedesc[Model]): T:type
This is never called and exists only to please the compiler.