PostgreSQL connection lifecycle, I/O, simple-query protocol, statement cache and LISTEN/NOTIFY support.
This module is a thin re-export hub. The actual implementation lives in the pg_connection/ subdirectory:
- pg_connection/types — PgConnection, ConnConfig, the tracing data types, the PgTracer hook record, and the tracing helper templates (withConnTracing, withTracing).
- pg_connection/dsn — DSN parsing (URI and libpq keyword=value formats) plus initConnConfig and parseDsn.
- pg_connection/buffer_io — recv/send buffering (fillRecvBuf, nextMessage, recvMessage, sendMsg), TCP keepalive, closeTransport, notification/notice dispatch, isConnected / socketHasFin, and the getHosts host helper.
- pg_connection/ssl — SSL negotiation (negotiateSSL) for chronos+BearSSL and asyncdispatch+OpenSSL.
- pg_connection/cache — client-side prepared-statement LRU.
- pg_connection/simple_query — simple-query / simple-exec / ping, cancel / invalidateOnTimeout, checkSessionAttrs, quoteIdentifier, quoteLiteral, QueryResult helpers.
- pg_connection/lifecycle — connect / connectToHost / close, orderedHosts (load-balanced host ordering) and the SCRAM/require_auth helpers.
- pg_connection/notify — LISTEN/NOTIFY pump, waitNotification, reconnectInPlace.
- pg_connection/type_lookup — lookupTypeOids generic helper to resolve type names to OIDs via to_regtype (extension types like hstore, citext, etc.).
What this hub re-exports is the public API. The submodules are internal: Nim needs a * on anything a sibling module uses, so their exported sets are wider than what the package promises, and importing one directly reaches symbols that carry no compatibility guarantee. tests/api_surface.golden freezes the whole exported set so a widening has to be reviewed.
Exports
-
ErrorField, isQueryCanceled, PgError, SqlStateNotNullViolation, PgStateError, SqlStateUniqueViolation, SqlStateForeignKeyViolation, PgNotifyOverflowError, SqlStateSyntaxError, newPoolError, schemaName, isForeignKeyViolation, PoolErrorKind, SqlStateSerializationFailure, PgMessageTooLargeError, tableName, SqlStateExclusionViolation, PgTimeoutError, PgListenStoppedError, position, isCheckViolation, isExclusionViolation, SqlStateQueryCanceled, where, SqlStateCheckViolation, constraintName, isIntegrityConstraintViolation, PgConfigError, PgConnectionError, isSerializationFailure, isUniqueViolation, internalPosition, isDeadlockDetected, PgQueryError, PgTypeError, PgListenError, PgProtocolError, isNotNullViolation, dataTypeName, SqlStateDeadlockDetected, internalQuery, PgPoolError, SqlStateUndefinedTable, ProtocolError, PgNoRowsError, PgNullError, columnName, errorField, getErrorField, PgConnState, state, SslMode, SslNegotiation, ChannelBindingMode, AuthMethod, TargetSessionAttrs, LoadBalanceHosts, HostEntry, ConnConfig, PgTracer, Notification, NotifyCallback, Notice, NoticeCallback, ReconnectCallback, NotifyOverflowCallback, ListenErrorCallback, CachedStmt, dialAddr, displayHost, QueryResult, CopyResult, CopyOutInfo, CopyInInfo, CopyOutCallback, CopyInCallback, PgPoolOwner, PgConnection, RowCallback, ClientCertPairingErrorMsg, TraceContext, TraceCopyDirection, TraceConnectStartData, TraceConnectEndData, TraceQueryStartData, TraceQueryEndData, TracePrepareStartData, TracePrepareEndData, TracePipelineStartData, TracePipelineEndData, TraceCopyStartData, TraceCopyEndData, TracePoolAcquireStartData, TracePoolAcquireEndData, TracePoolReleaseStartData, TracePoolReleaseEndData, TracePoolDoubleReleaseData, TracePoolCloseErrorData, TraceTransportCloseErrorData, TransportCloseStage, CleanupKind, CleanupSkipReason, TraceCleanupSkippedData, TraceLeakedSessionLocksData, TraceInsecureAuthData, TraceDeprecatedAuthData, TraceAdvisoryUnlockFailedData, txStatus, pid, host, port, config, createdAt, sslEnabled, serverParams, serverParam, notifyDropped, listenError, notifyMaxQueue, notifyMaxQueue=, listenReconnectMaxAttempts, listenReconnectMaxAttempts=, listenReconnectMaxBackoff, listenReconnectMaxBackoff=, stmtCacheCapacity, stmtCacheCapacity=, withConnTracing, withTracing, initConnConfig, parseDsn, isUnixSocket, unixSocketPath, getHosts, makeCopyOutCallback, makeCopyInCallback, socketHasFin, socketHasPendingData, isConnected, len, columnIndex, rows, items, quoteIdentifier, quoteLiteral, cancel, cancelNoWait, invalidateOnTimeout, simpleExec, simpleQuery, ping, checkSessionAttrs, close, orderedHosts, connect, connect, connectToHost, onNotify, onListenError, onNotice, onReconnect, onNotifyOverflow, listen, unlisten, stopListening, waitNotification, TypeOidInfo, lookupTypeOids