These libraries are experimental. APIs may change without notice. Generated from source with koruc 0.1.7 on 11/4/2026.

Pg

@korulang/pg@0.0.1

Native PostgreSQL wire-protocol driver for Koru — no libpq, event-loop-native, zero-copy rows

pg/index.kz · 10 tors

@korulang/pg — native pgwire driver. No libpq, no C object model: the connection owns its recv buffer, rows are zero-copy views into it, and the fd is the caller's to drive (block on it, or register it on an event loop — the codec doesn't care which). Design doc: ./DESIGN.md — spike-proven numbers inline there. conn = pg:connect(host, port, user, database): c pg:query(conn, "SELECT ...") — simple protocol, blocks pg:row.next(conn) -> bool — advance to next DataRow pg:col.bytes(conn, i) -> string — view into rx buffer pg:disconnect(conn)

Phantom lifecycles

Derived from the phantom labels in the declarations below — state! issues an obligation the compiler will chase, !state discharges it, a bare state holds it without moving it. Nothing here is hand-drawn.

Conn 2 states connected!

connect

<connected!> index.kz:76

socket

<*> index.kz:137

set-nonblocking

<*> index.kz:143

disconnect

<!connected> index.kz:150

query

<connected> index.kz:162

row.next

<connected> index.kz:183

prepare

<connected> index.kz:227

bind.exec

<connected> index.kz:271

send.pending

<connected> index.kz:293

col.bytes

<connected> index.kz:306