Funcs to convert between Nim types and SQLite types and between Nim values and lowdb.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 lowdb.sqlite.DbValue
- to(DbValue, T: typedesc[YourType]) -> T that converts lowdb.sqlite.DbValue instances to YourType.
Procs
func dbType(T: typedesc[bool]): string
func dbType(T: typedesc[DateTime]): string
func dbType(T: typedesc[DbBlob]): string
func dbType(T: typedesc[SomeFloat]): string
func dbType(T: typedesc[SomeInteger | enum]): 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: bool): DbValue {....raises: [], tags: [], forbids: [].}
func dbValue(val: DateTime): DbValue {....raises: [], tags: [], forbids: [].}
func dbValue(val: Option[bool]): DbValue {....raises: [], tags: [], forbids: [].}
func dbValue(val: Option[DateTime]): DbValue {....raises: [], tags: [], forbids: [].}
func dbValue(val: typeof(nil)): DbValue {....raises: [], tags: [], forbids: [].}
func dbValue[T](val: PaddedStringOfCap[T]): DbValue
func dbValue[T](val: StringOfCap[T]): DbValue
func to(dbVal: DbValue; T: typedesc[bool]): T:type
proc to(dbVal: DbValue; T: typedesc[DateTime]): T:type
func to(dbVal: DbValue; T: typedesc[DbBlob]): T:type
func to(dbVal: DbValue; T: typedesc[Model]): T:type
- This is never called and exists only to please the compiler.
func to(dbVal: DbValue; T: typedesc[SomeFloat]): T:type
func to(dbVal: DbValue; T: typedesc[SomeInteger | enum]): T:type
func to(dbVal: DbValue; T: typedesc[string]): T:type
func to[T1](dbVal: DbValue; T2: typedesc[PaddedStringOfCap[T1]]): T2:type
func to[T1](dbVal: DbValue; T2: typedesc[StringOfCap[T1]]): T2:type
proc to[T](dbVal: DbValue; O: typedesc[Option[T]]): O:type