Module postgres

June 1, 2026 · View on GitHub

⤌ Back

Module postgres

An enterprise-grade PostgreSQL client library for the Zuri programming language, implementing the PostgreSQL Frontend/Backend wire protocol (version 3.0) in pure Zuri with full binary type encoding and decoding.

Features

  • Single connections via Connection for straightforward use-cases.
  • Connection pooling via Pool for high-throughput applications.
  • Full binary wire protocol for all built-in PostgreSQL data types.
  • Named prepared statements for optimised, repeatable query execution.
  • Doubly-linked cache cursors for memory-efficient result streaming.
  • LISTEN / NOTIFY for real-time async notifications.
  • Extensible type system — register custom OID ↔ Zuri type mappings.
  • Array support — multidimensional arrays with fast binary encode/decode.
  • SASL / MD5 / clear-text authentication.
  • SSL/TLS upgrade via the ssl module.
  • Auto resource cleanup with close() on all disposable objects.

Quick start

import postgres { Connection }
var conn = Connection('postgres://localhost/mydb')
conn.connect()
var result = conn.query(
  'select id, name from users where active = \$1',
  { params: [true] }
)
for row in result.rows {
  echo row
}
conn.close()

Copyright: 2024, The Zuri Authors