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

pq

@korulang/pq@0.0.1

libpq (PostgreSQL) bindings for Koru, lifted behind phantom-typed connection and result obligations

pq/index.kz · 30 tors

@korulang/postgres - PostgreSQL client for Koru A semantic redesign of libpq using phantom obligations to make an entire class of database bugs impossible at compile time.

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 5 states connected!connecting!in_tx!in_failed_tx!
Result 1 state result!

connect

<connected!> index.kz:37

disconnect

<!connected> index.kz:58

exec

<connected> index.kz:73

query

<connected><result!> index.kz:89

result.nrows

<result> index.kz:111

result.col

<result> index.kz:120

result.clear

<!result> index.kz:134

connect-start

<connecting!> index.kz:156

connect-poll

<!connecting><connected!><connecting!> index.kz:182

conn.close

<!connecting|!in_tx|!in_failed_tx> index.kz:212

socket

<*> index.kz:222

set-nonblocking

<*> index.kz:231

send-query

<connected> index.kz:245

consume-input

<connected> index.kz:260

is-busy

<connected> index.kz:274

get-result

<connected><result!> index.kz:286

flush

<connected> index.kz:312

tx.begin

<!connected><in_tx!> index.kz:329

tx.commit

<!in_tx><connected!><in_failed_tx!> index.kz:347

tx.rollback

<*><connected!> index.kz:370

tx.query

<in_tx><result!> index.kz:391

exec-params

<connected><result!> index.kz:420

prepare

<connected> index.kz:444

exec-prepared

<connected><result!> index.kz:459

result.ncols

<result> index.kz:487

result.field-name

<result> index.kz:494

result.getv

<result> index.kz:504

result.error

<result> index.kz:517

conn.error

<*> index.kz:526

sql

comptime index.kz:544