@sassoftware/postgrest-client
v0.7.1
Published
Type-safe PostgREST client
Downloads
7
Maintainers
Keywords
Readme
PostgREST Client
General purpose type-safe TypeScript client for PostgREST.
Table of Contents
Overview
The PostgREST Client is a type-safe TypeScript client designed for use with PostgREST. It allows for efficient and straightforward interaction with PostgREST APIs, offering a comprehensive suite of features for various operations.
Features
- 🔳 Read
- 🔳 Horizontal filtering
- 🔳 Operators
- ✅ Logical operators
- ⬜ Operator modifiers
- 🔳 Pattern matching
- ⬜ Full-text search
- ✅ Vertical filtering
- ✅ Renaming columns
- ✅ Casting columns
- ✅ JSON columns
- ✅ Composite/Array columns
- ✅ Ordering
- ✅ Limits and pagination
- ✅ Count
- 🔳 Horizontal filtering
- ✅ Head
- ✅ Insert
- ✅
prefer: return=
header - ✅ Bulk insert
- ✅
prefer: missing=
header - ✅ specifying columns
- ✅
- ✅ Update
- ✅ Limited update
- ✅ Upsert
- ✅
prefer: resolution=
header - ✅ On conflict
- ✅
- ✅ Put
- ✅ Delete
- ✅
prefer: return=
header - ✅ Limited delete
- ✅
- ⬜ Stored procedures
- 🔳 Schemas
- 🔳 Resource embedding
- ✅ Foreign key joins
- ✅ Foreign key joins on write
- ✅ Nested embedding
- ✅ Embedded filtering
- ✅ Top-level filtering
- ⬜ Null filtering
- ✅ Empty embedded
- ✅ Embedded ordering
- ✅ Top-level ordering
- ⬜ Spread embedded resources
- 🔳 Resource representation
- ✅ Singular or plural
- ⬜ Stripped nulls
- ⬜ Response format
- ⬜ Options method
- ✅ URL grammar
- ✅ Unicode support
- ✅ Table / Columns with spaces
- ✅ Reserved characters
Installation
To get started with the PostgREST Client detailed instructions are available in our Getting Started Documentation.
Examples
Using schema from PostgREST documentation for examples.
import {
PostgrestClient,
type PostgresTable,
} from '@sassoftware/postgrest-client';
type DB = {
films: PostgresTable<{ id: number; title: string }, 'id'>;
};
const pgClient = new PostgrestClient<DB>({ base: '/api' });
const { rows } = await pgClient.get({ query: pgClient.query('films') });
For more examples and detailed usage instructions, visit our Queries Documentation.
Contributing
We welcome your contributions! Please read CONTRIBUTING.md for details on how to submit contributions to this project.
License
This project is licensed under the Apache 2.0 License.
Additional Resources
- Getting Started Documentation
- Queries Documentation
- More examples available in TSDocs