A no-nonsense, type-safe and tiny query builder wrapping postgres.js
.
- 🛡️ Type-safe queries with TypeScript
- 🔒 SQL injection prevention
- 🎯 Simple CRUD operation builders
- 📦 Thin wrapper over postgres.js
npm install pgbuddy postgres
import postgres from 'postgres';
import { PgBuddy } from 'pgbuddy';
const sql = postgres('postgres://username:password@localhost:5432/dbname');
const pgBuddy = new PgBuddy(sql);
interface User {
id: number;
email: string;
}
const userTable = pgBuddy.table<User>('users');
// Simple type-safe queries
await userTable.select({
where: { email: '[email protected]' }
});
PgBuddy provides type-safe wrappers for common database operations. For complete documentation, visit:
PgBuddy is a wrapper around postgres.js. For advanced PostgreSQL features like:
- Transactions
- Prepared Statements
- Listen/Notify
- Copy Operations
- Custom Types
- Connection Pooling
Please refer to the postgres.js documentation.
MIT
Contributions welcome! Please read our contributing guidelines first.