| Crates.io | sqly |
| lib.rs | sqly |
| version | 0.4.0 |
| created_at | 2024-08-28 12:36:14.493932+00 |
| updated_at | 2025-04-10 06:22:59.201231+00 |
| description | A lightweight macro system on top of sqlx |
| homepage | |
| repository | https://github.com/LMOORS30/sqly |
| max_upload_size | |
| id | 1354604 |
| size | 142,266 |
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).
[dependencies.sqly]
version = "0.4.0"
features = ["postgres"]
[dependencies.sqlx]
version = "0.8.0"
default-features = false
[profile.dev.package.sqlx-macros]
opt-level = 3
[profile.dev.package.sqly-macros]
opt-level = 3
postgres — generate queries for PostgreSQL
mariadb — generate queries for MariaDB (not supported)
sqlite — generate queries for SQLite (not supported)
mysql — generate queries for MySQL (not supported)
checked — enable compile-time checking (default)
Currently only postgres is supported.
Major
DELETE queriesINSERT queriesUPDATE queriesSELECT queries
#[derive] invocations#[sqly(foreign)]
INNER JOINLEFT JOINsqly::query! macros to extend generated queriesMinor
Flat::Flat type for flexibility#[sqly(infer)] for custom sqlx types#[sqly(value)] for custom parameter binding#[sqly(select)] for custom SQL select expressions#[sqly(default, from)] for decoding table fields#[sqly(insert, update)] for custom SQL value expressions#[sqly(filter)] for custom SQL filter expressions#[sqly(optional)] for dynamic SQL through optional fields#[sqly(returning)] for SQL RETURNING clauseDraft
#[sqly(group)] for SQL GROUP BY clause#[sqly(distinct, order, limit, offset)] clauses