norm/private/postgres/dbtypes

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

Procs

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

Funcs

func dbType(T: typedesc[int16]): string
func dbType(T: typedesc[int32]): string
func dbType(T: typedesc[int64]): string
func dbType(T: typedesc[float32]): string
func dbType(T: typedesc[float64]): string
func dbType(T: typedesc[string]): string
func dbType[C](_: typedesc[StringOfCap[C]]): string
func dbType[C](_: typedesc[PaddedStringOfCap[C]]): string
func dbType(T: typedesc[bool]): string
func dbType(T: typedesc[DateTime]): string
func dbType(T: typedesc[Model]): string
func dbType[T](_: typedesc[Option[T]]): string
func dbValue[T: Model](val: T): DbValue
func dbValue[T: Model](val: Option[T]): DbValue
func dbValue[_](val: StringOfCap[_]): DbValue
func dbValue[_](val: PaddedStringOfCap[_]): 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[StringOfCap[_]]): T:type
func to[_](dbVal; T: typedesc[PaddedStringOfCap[_]]): T:type
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.