Skip to content
necessary-nuPublic

About

No description, website, or topics provided.

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3,829 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pgorm

pgorm is an async ORM for PostgreSQL, and for PostgreSQL alone. You declare each table as a Rust type, and pgorm reads and writes it with SQL it builds for you: every value bound as a parameter, never pasted into the SQL, and each statement prepared and cached per connection. Where the types can say so, a statement PostgreSQL would refuse does not compile. It runs on tokio-postgres and a deadpool pool, and targets PostgreSQL 18 (or 19, with the pg-19 feature).

Because it serves one database, pgorm offers what PostgreSQL has: RETURNING on every write, ON CONFLICT and MERGE, COPY in and out, LISTEN and NOTIFY, enums, domains, arrays, JSON, ranges and multiranges, and PostgreSQL 18's virtual generated columns and temporal keys. Beside the ORM it has a typed SQL builder, a PRQL-shaped pipeline for composing queries, compile-time checking of raw SQL against PostgreSQL's own grammar, entities stored as a base table plus a table per kind, an opt-in metrics layer, a forward-only migration runner and an entity generator. Python and JavaScript bindings wrap the same crate.

Documentation

  • The guide teaches pgorm from a first query to every feature, and every example in it runs as a test. It is also the pgorm::guide module of the API documentation: run cargo doc --open and follow guide, where the examples read without their test scaffolding and every link resolves.
  • The Python guide is its dialect for Python, chapter for chapter, every example run against a server.
  • The JavaScript guide is its dialect for Node.js and Deno, chapter for chapter, every example run in both runtimes.
  • Coming from SeaORM maps each SeaORM API to what replaces it, for porting an application. pgorm began as a fork of SeaORM and keeps its shape: entities, models, active models and relations.
  • The API reference is cargo doc.
[dependencies]
pgorm = { git = "https://github.com/necessary-nu/pgorm" }

pgorm depends on forks of two crates, pinned to a git revision, so it is not published on crates.io; depend on it by git.

The repository

Crate What it is
pgorm The ORM
pgorm-query The SQL builder, re-exported as pgorm::pgorm_query
pgorm-macros, pgorm-sql-macro The derives, and the sql! and prql! macros
pgorm-pool The connection pool
pgorm-migration The migration runner (guide)
pgorm-codegen Entity generation from DDL (guide)
pgorm-python The Python package pgorm (guide)
pgorm-napi The npm package @necessary/pgorm, for Node.js and Deno (guide)

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

No description, website, or topics provided.

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages