Common datatypes and definitions for alldb_*.nim (db_mysql,db_postgres, anddb_sqlite) modules.
DbColumn=objectname*:string## name of the columntableName*:string## name of the table the column belongs to (optional)typ*:DbType## type of the columnprimaryKey*:bool## is this a primary key?foreignKey*:bool## is this a foreign key?
DbEffect=objectofIOEffect
DbError=objectofIOError
DbType=objectkind*:DbTypeKind## the kind of the described typenotNull*:bool## does the type contain NULL?name*:string## the name of the typesize*:Natural## the size of the datatype; 0 if of variable sizemaxReprLen*:Natural## maximal length required for the representationprecision*,scale*:Natural## precision and scale of the numbermin*,max*:BiggestInt## the minimum and maximum of allowed valuesvalidValues*:seq[string]## valid values of an enum or a set
DbTypeKind=enumdbUnknown,## unknown datatypedbSerial,## datatype used for primary auto-increment keysdbNull,## datatype used for the NULL valuedbBit,## bit datatypedbBool,## boolean datatypedbBlob,## blob datatypedbFixedChar,## string of fixed lengthdbVarchar,## string datatypedbJson,## JSON datatypedbXml,## XML datatypedbInt,## some integer typedbUInt,## some unsigned integer typedbDecimal,## decimal numbers (fixed-point number)dbFloat,## some floating point typedbDate,## a year-month-day descriptiondbTime,## HH:MM:SS informationdbDatetime,## year-month-day and HH:MM:SS information,## plus optional time or timezone informationdbTimestamp,## Timestamp values are stored as the number of seconds## since the epoch ('1970-01-01 00:00:00' UTC).dbTimeInterval,## an interval [a,b] of timesdbEnum,## some enumdbSet,## set of enum valuesdbArray,## an array of valuesdbComposite,## composite type (record, struct, etc)dbUrl,## a URLdbUuid,## a UUIDdbInet,## an IP addressdbMacAddress,## a MAC addressdbGeometry,## some geometric typedbPoint,## Point on a plane (x,y)dbLine,## Infinite line ((x1,y1),(x2,y2))dbLseg,## Finite line segment ((x1,y1),(x2,y2))dbBox,## Rectangular box ((x1,y1),(x2,y2))dbPath,## Closed or open path (similar to polygon) ((x1,y1),...)dbPolygon,## Polygon (similar to closed path) ((x1,y1),...)dbCircle,## Circle <(x,y),r> (center point and radius)dbUser1,## user definable datatype 1 (for unknown extensions)dbUser2,## user definable datatype 2 (for unknown extensions)dbUser3,## user definable datatype 3 (for unknown extensions)dbUser4,## user definable datatype 4 (for unknown extensions)dbUser5## user definable datatype 5 (for unknown extensions)
ReadDbEffect=objectofDbEffect
SqlQuery=distinctstring
WriteDbEffect=objectofDbEffect
procdbError(msg:string) {.noreturn,noinline,...raises:[DbError],tags:[],forbids:[].}
templatesql(query:string):SqlQuery
constructs a SqlQuery from the stringquery. This is supposed to be used as a raw-string-literal modifier:sql"update user set counter = counter + 1"
If assertions are turned off, it does nothing. If assertions are turned on, later versions will check the string for valid syntax.