using-bigal

Model PostgreSQL entities and build fluent queries in TypeScript with BigAl.

11|2|Updated Nov 22, 2017
One-click install
npx skills add https://github.com/bigalorm/bigal --skill using-bigal
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-bigal
Source: https://github.com/bigalorm/bigal/tree/main/skills/using-bigal
Command: npx skills add https://github.com/bigalorm/bigal --skill using-bigal

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Type-safe PostgreSQL data access in TypeScript is error-prone when using raw SQL or weakly typed mappers. This Skill provides structured guidance to model entities with decorators, craft fluent queries, and leverage the repository pattern for CRUD and complex queries.

Core Features & Use Cases

  • Decorator-based model definitions and schema control
  • Fluent query builder for find, count, join, and subqueries
  • Repository pattern for CRUD operations and upserts
  • JSONB querying, pagination, and DISTINCT ON support
  • Guidance on when to use BigAl vs raw SQL in real-world apps

Quick Start

Install BigAl, define an Entity using decorators, initialize the repository, and execute a simple find query.

Frequently Asked Questions about using-bigal

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build type-safe PostgreSQL data access in TypeScript using an ORM?

Type-safe PostgreSQL data access in TypeScript is achieved by defining entities with decorators, using a fluent query builder, and applying the repository pattern for structured CRUD operations and complex queries.

How do I query JSONB columns and apply pagination in a TypeScript ORM?

Querying JSONB columns and applying pagination are handled through the fluent query builder, which provides specific methods for JSONB querying, pagination, and DISTINCT ON support to manage complex data retrieval.

When should I use a TypeScript ORM versus raw SQL for PostgreSQL data access?

A TypeScript ORM is best for structured CRUD and type-safe modeling, while raw SQL is preferred for complex queries. Guidance on choosing between them is based on specific application scenarios and performance needs.

How do I define entity models with decorators for a TypeScript repository?

Entity models are defined using decorator-based annotations to control schema, enabling type-safe mapping. You initialize the repository and execute find queries to interact with PostgreSQL.

Can I perform joins and subqueries using a fluent query builder in TypeScript?

Yes, the fluent query builder supports joins and subqueries, allowing you to craft complex find and count operations while maintaining type safety across your PostgreSQL data layer.