sqly
sqly is a lightweight macro system on top of sqlx, inspired by ormx.
It works by generating common SQL queries and associated structs at compile time, letting the generated queries be checked and executed by sqlx.
This crate differs from ormx mainly by the added functionality of generating SQL SELECT queries with support for nested objects through SQL JOIN clauses. Additionally, sqly::query! macros can be used to further expand generated queries while still providing compile-time verification.
This functionality is still under development (see Roadmap).
Cargo.toml
[]
= "0.1.0"
= ["postgres"]
[]
= "0.8.0"
= false
= ["macros", "postgres"]
Features
unchecked — disable compile-time checking
postgres — generate queries for PostgreSQL
sqlite — generate queries for SQLite (not supported)
mysql — generate queries for MySQL (not supported)
Currently only postgres is supported.
Usage
Roadmap
- Basic
DELETEqueries - Basic
INSERTqueries - Basic
UPDATEqueries - Storing information across separate
#[derive]invocations - Basic
SELECTqueries -
sqly::query!macros to extend generated queries -
#[sqly(alias)]attribute and optional override in macros -
#[sqly(default, from, try_from, flatten)]attributes for select -
#[sqly(optional)]attribute for optional update and insert fields -
#[sqly(returning)]attribute for generating SQLRETURNINGclauses -
#[sqly(foreign)]attributes for nested objects through SQLJOINclauses - Implementation of bulk operations for
&[T] - Support for SQL
DISTINCTclause in select - Support for including constants in the SQL
- Support for filtering on nullable columns
- Support for foreign macro attributes
- Support for generics
- ... ?