pgx
Module pgx
provides PostgreSQL functionality from the
pgx (opens in a new tab) library.
Functions
connect
Function signature
connect(dsn string) conn
Connect to the database specified by the dsn string.
Example
>>> conn := pgx.connect("postgres://user:pass@localhost:5432/db")
>>> conn.query("SELECT * FROM users")
[{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}]
>>> conn.close()
Types
conn
Represents a connection to a PostgreSQL database.
Attributes
Name | Type | Description |
---|---|---|
query | func(sql string, args ...object) list | Return a list of records generated by the query |
close | func() | Close the connection |