Procs
proc decodeBinaryArray(data: openArray[byte]): tuple[elemOid: int32, dims: seq[int32], lowerBounds: seq[int32], elements: seq[tuple[off: RelOff, len: int]]] {....raises: [PgTypeError], tags: [], forbids: [].}
-
Decode a PostgreSQL binary array header into element OID, per-dimension length and lower bound, and (offset, length) pairs for each element in row-major order. Offsets are relative to the start of data (typed as RelOff); recover the absolute parent-buffer offset via parentOff + e.off. An element len of -1 represents NULL.
ndim may be 0..PgArrayMaxDim; arrays with more dimensions than PostgreSQL's MAXDIM are rejected. For an empty array (ndim=0) dims, lowerBounds and elements are all empty.
proc decodeBinaryComposite(data: openArray[byte]): seq[ tuple[oid: int32, off: RelOff, len: int]] {....raises: [PgTypeError], tags: [], forbids: [].}
- Decode a PostgreSQL binary composite value. Returns (typeOid, offset, length) tuples. off is relative to data (typed as RelOff); recover the absolute parent-buffer offset with parentOff + f.off. len of -1 indicates NULL.
proc decodeBinaryDate(data: openArray[byte]): DateTime {....raises: [PgTypeError], tags: [], forbids: [].}
proc decodeBinaryTime(data: openArray[byte]): PgTime {....raises: [PgTypeError], tags: [], forbids: [].}
proc decodeBinaryTimestamp(data: openArray[byte]): DateTime {. ...raises: [PgTypeError], tags: [], forbids: [].}
proc decodeBinaryTimeTz(data: openArray[byte]): PgTimeTz {. ...raises: [PgTypeError], tags: [], forbids: [].}
proc decodeBinaryTsQuery(data: openArray[byte]): string {....raises: [PgTypeError], tags: [], forbids: [].}
- Decode PostgreSQL binary tsquery (prefix/preorder) to text representation (infix).
proc decodeBinaryTsVector(data: openArray[byte]): string {. ...raises: [PgTypeError], tags: [], forbids: [].}
- Decode PostgreSQL binary tsvector to text representation.
proc decodeHstoreBinary(data: openArray[byte]): PgHstore {. ...raises: [PgTypeError], tags: [], forbids: [].}
- Decode PostgreSQL binary hstore format.
proc decodeInetBinary(data: openArray[byte]): tuple[address: IpAddress, mask: uint8] {....raises: [PgTypeError], tags: [], forbids: [].}
- Decode PostgreSQL binary inet/cidr format: 1 byte: family (2=IPv4, 3=IPv6) 1 byte: bits (netmask length) 1 byte: is_cidr (0 or 1) 1 byte: addrlen (4 or 16) N bytes: address
proc decodeNumericBinary(data: openArray[byte]): PgNumeric {. ...raises: [PgTypeError], tags: [], forbids: [].}
- Decode PostgreSQL binary numeric format into PgNumeric.
proc decodePointBinary(data: openArray[byte]; off: int): PgPoint {. ...raises: [PgTypeError], tags: [], forbids: [].}
- Decode a point from 16 bytes at offset.
proc fromPgText(data: seq[byte]; oid: int32): string {....raises: [], tags: [], forbids: [].}
- Convert text-format bytes from PostgreSQL to a Nim string.
proc parseHstoreText(s: string): PgHstore {....raises: [PgTypeError], tags: [], forbids: [].}
- Parse PostgreSQL hstore text format: "key1"=>"val1", "key2"=>NULL.
proc parseInetText(s: string): tuple[address: IpAddress, mask: uint8] {. ...raises: [ValueError], tags: [], forbids: [].}
proc parseIntervalText(s: string): PgInterval {....raises: [], tags: [], forbids: [].}
- Parse PostgreSQL default interval text format: "1 year 2 mons 3 days 04:05:06.123456" "-1 year -2 mons +3 days -04:05:06" "00:00:00"
proc parsePointsText(s: string): seq[PgPoint] {. ...raises: [PgTypeError, ValueError], tags: [], forbids: [].}
- Parse a comma-separated list of points like "(x1,y1),(x2,y2),...".
proc parsePointText(s: string): PgPoint {....raises: [PgTypeError, ValueError], tags: [], forbids: [].}
- Parse "(x,y)" text format.
proc parseTextArray(s: string): seq[Option[string]] {....raises: [PgTypeError], tags: [], forbids: [].}
- Parse PostgreSQL text-format array literal: {elem1,elem2,...} Returns elements as Option[string] (none for NULL).
proc parseTimestampText(s: string): DateTime {. ...raises: [PgTypeError, TimeFormatParseError], tags: [TimeEffect], forbids: [].}
proc parseTimeText(s: string): PgTime {....raises: [PgTypeError, PgTypeError, PgTypeError], tags: [], forbids: [].}
- Parse PostgreSQL time text format: "HH:mm:ss" or "HH:mm:ss.ffffff".
proc parseTimeTzText(s: string): PgTimeTz {....raises: [PgTypeError, PgTypeError], tags: [], forbids: [].}
proc rejectMultiDim(decoded: tuple[elemOid: int32, dims: seq[int32], lowerBounds: seq[int32], elements: seq[tuple[off: RelOff, len: int]]]) {. ...raises: [PgTypeError], tags: [], forbids: [].}
- Raise PgTypeError when decoded represents a multi-dimensional array, since the 1-D getXxxArray accessors cannot flatten the result without losing the shape. ndim=0 (empty array) is allowed. Callers that want multi-dim support should use the PgArray[T] accessors.