pry-pgadapter is a FiveM resource that bridges FXServer resources with a PostgreSQL database. It is built on top of node-postgres (pg) and exposes a familiar, battle-tested API surface compatible with oxmysql, mysql-async, and ghmattimysql — allowing you to migrate existing MySQL-based resources to PostgreSQL with minimal effort.
| Feature | Description |
|---|---|
| PostgreSQL-native | Full support for PostgreSQL via node-postgres. No MySQL emulation layer. |
Lua PG API |
Global PG object with sync (await) and async (callback) variants for every method. |
| PGBuilder | Fluent Lua query builder for type-safe, composable queries without raw SQL. |
| TypeScript / JS client | First-class pgadapter module for TypeScript resources. |
| Compatibility layer | Drop-in replacement for mysql-async and ghmattimysql exports. |
| Named & positional params | Supports both ? positional and :name / @name named placeholders. |
| JSONB support | Native JSONB operators (@>, jsonb_exists) accessible from Lua and PGBuilder. |
| Transactions | Simple batch transactions and advanced manual startTransaction. |
| Query profiler | Slow query detection with configurable threshold and in-game UI dashboard. |
| Type casting | Automatic conversion of PostgreSQL types to Lua/JS-native equivalents. |
pry-pgadapter runs as a server-side FXServer resource. It:
- Reads the
pg_connection_stringconvar at startup. - Creates a connection pool via
node-postgres. - Exposes exports (
PG.query,PG.insert, etc.) consumed by other resources. - Translates the MySQL-compatible API surface (
?placeholders, callbacks) into native PostgreSQL wire protocol calls.
Other resources import the shared Lua library (@pry-pgadapter/lib/PG.lua) to access the PG global, or the TypeScript package for JS-based resources.