src/types

Search:
Group by:

Types

Column = ref object
  idx*: int
  name*: string
  kind*: DuckType
DuckType {.pure.} = enum
  Invalid = 0, Boolean = 1, TinyInt = 2, SmallInt = 3, Integer = 4, BigInt = 5,
  UTinyInt = 6, USmallInt = 7, UInteger = 8, UBigInt = 9, Float = 10,
  Double = 11, Timestamp = 12, Date = 13, Time = 14, Interval = 15,
  HugeInt = 16, Varchar = 17, Blob = 18, Decimal = 19, TimestampS = 20,
  TimestampMs = 21, TimestampNs = 22, Enum = 23, List = 24, Struct = 25,
  Map = 26, UUID = 27, Union = 28, Bit = 29, TimeTz = 30, TimestampTz = 31,
  UHugeInt = 32, Array = 33, Any = 34, VarInt = 35, SqlNull = 36
LogicalType = object
  handle*: duckdb_logical_type
Timestamp {.borrow: `.`.} = distinct DateTime
ValidityMask = object
  handle*: ptr UncheckedArray[uint64]
  size*: int
Value = ref object of ValueBase
Vector = ref object
  mask*: seq[uint64] = []
  case kind*: DuckType
  of DuckType.Invalid, DuckType.ANY, DuckType.VARINT, DuckType.SQLNULL:
    valueInvalid*: uint8
  of DuckType.Boolean:
    valueBoolean*: seq[bool]
  of DuckType.TinyInt:
    valueTinyint*: seq[int8]
  of DuckType.SmallInt:
    valueSmallint*: seq[int16]
  of DuckType.Integer:
    valueInteger*: seq[int32]
  of DuckType.BigInt:
    valueBigint*: seq[int64]
  of DuckType.UTinyInt:
    valueUTinyint*: seq[uint8]
  of DuckType.USmallInt:
    valueUSmallint*: seq[uint16]
  of DuckType.UInteger:
    valueUInteger*: seq[uint32]
  of DuckType.UBigInt:
    valueUBigint*: seq[uint64]
  of DuckType.Float:
    valueFloat*: seq[float32]
  of DuckType.Double:
    valueDouble*: seq[float64]
  of DuckType.Timestamp:
    valueTimestamp*: seq[Timestamp]
  of DuckType.Date:
    valueDate*: seq[DateTime]
  of DuckType.Time:
    valueTime*: seq[Time]
  of DuckType.Interval:
    valueInterval*: seq[TimeInterval]
  of DuckType.HugeInt:
    valueHugeint*: seq[Int128]
  of DuckType.Varchar:
    valueVarchar*: seq[string]
  of DuckType.Blob:
    valueBlob*: seq[seq[byte]]
  of DuckType.Decimal:
    valueDecimal*: seq[DecimalType]
  of DuckType.TimestampS:
    valueTimestampS*: seq[DateTime]
  of DuckType.TimestampMs:
    valueTimestampMs*: seq[DateTime]
  of DuckType.TimestampNs:
    valueTimestampNs*: seq[DateTime]
  of DuckType.Enum:
    valueEnum*: seq[uint]
  of DuckType.List, DuckType.Array:
    valueList*: seq[seq[Value]]
  of DuckType.Struct:
    valueStruct*: seq[Table[string, Value]]
  of DuckType.Map:
    valueMap*: seq[Table[string, Value]]
  of DuckType.UUID:
    valueUUID*: seq[Uuid]
  of DuckType.Union:
    valueUnion*: seq[Table[string, Value]]
  of DuckType.Bit:
    valueBit*: seq[string]
  of DuckType.TimeTz:
    valueTimeTz*: seq[ZonedTime]
  of DuckType.TimestampTz:
    valueTimestampTz*: seq[ZonedTime]
  of DuckType.UHugeInt:
    valueUHugeint*: seq[UInt128]

Procs

proc `$`(ltp: LogicalType): string {....raises: [ValueError], tags: [], forbids: [].}
proc `$`(x: Timestamp): string {....raises: [], tags: [], forbids: [].}
proc `==`(x, y: Timestamp): bool {.borrow, ...raises: [], tags: [], forbids: [].}
proc `=copy`(dest: var Statement; source: Statement) {.
    error: "Statement cannot be copied".}
proc `=destroy`(ltp: LogicalType) {....raises: [], tags: [], forbids: [].}
proc `=destroy`(pqresult: PendingQueryResult) {....raises: [], tags: [],
    forbids: [].}
proc `=destroy`(qresult: QueryResult) {....raises: [], tags: [], forbids: [].}
proc `=destroy`(statement: Statement) {....raises: [], tags: [], forbids: [].}
Destroys a prepared statement instance if it exists
proc `=dup`(statement: Statement): Statement {.
    error: "Statement cannot be duplicated".}
proc format(dt: Timestamp; f: string): string {....raises: [TimeFormatParseError],
    tags: [], forbids: [].}
proc isValid(validity: ValidityMask; idx: int): bool {.inline,
    ...raises: [ValueError], tags: [], forbids: [].}
proc newDuckType(i: duckdb_logical_type): DuckType {....raises: [ValueError],
    tags: [], forbids: [].}
proc newDuckType(i: enum_DUCKDB_TYPE): DuckType {....raises: [ValueError],
    tags: [], forbids: [].}
proc newDuckType(i: LogicalType): DuckType {....raises: [ValueError], tags: [],
    forbids: [].}
proc newDuckType(node: NimNode): DuckType {....raises: [ValueError], tags: [],
    forbids: [].}
proc newDuckType[T](t: typedesc[T]): DuckType
proc newLogicalType(i: duckdb_logical_type): LogicalType {....raises: [], tags: [],
    forbids: [].}
proc newLogicalType(pt: DuckType): LogicalType {....raises: [], tags: [],
    forbids: [].}
proc newValidityMask(): ValidityMask {....raises: [], tags: [], forbids: [].}
proc newValidityMask(vec: duckdb_vector; size: int; isWritable: bool = false): ValidityMask {.
    ...raises: [], tags: [], forbids: [].}
proc setValidity(validity: ValidityMask; rowIdx: int; isValid: bool) {.
    ...raises: [], tags: [], forbids: [].}
proc toTime(x: Timestamp): Time {.borrow, ...raises: [], tags: [], forbids: [].}

Converters

converter toBase(p: PendingQueryResult): duckdb_pending_result {....raises: [],
    tags: [], forbids: [].}
converter toBase(p: ptr PendingQueryResult): ptr duckdb_pending_result {.
    ...raises: [], tags: [], forbids: [].}
converter toBase(s: ptr Statement): ptr duckdb_prepared_statement {....raises: [],
    tags: [], forbids: [].}
converter toBase(s: Statement): duckdb_prepared_statement {....raises: [],
    tags: [], forbids: [].}

Templates

template toEnum[T](x: int): T