Crates.io | sqly |
lib.rs | sqly |
version | 0.3.0 |
source | src |
created_at | 2024-08-28 12:36:14.493932 |
updated_at | 2024-10-17 13:58:19.144217 |
description | A lightweight macro system on top of sqlx |
homepage | |
repository | https://github.com/LMOORS30/sqly |
max_upload_size | |
id | 1354604 |
size | 64,395 |
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.3.0"
features = ["postgres"]
[dependencies.sqlx]
version = "0.8.0"
default-features = false
features = ["postgres", "macros"]
[profile.dev.package.sqlx-macros]
opt-level = 3
[profile.dev.package.sqly-macros]
opt-level = 3
unchecked
— disable compile-time checking
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)
Currently only postgres is supported.
Major
DELETE
queriesINSERT
queriesUPDATE
queriesSELECT
queries
#[derive]
invocations#[sqly(foreign)]
INNER JOIN
LEFT JOIN
sqly::query!
macros to extend generated queriesMinor
Table::Flat
type for convenience
#[derive(Flat)]
and #[sqly(flat)]
for flexibility#[sqly(infer)]
for custom sqlx types#[sqly(value)]
for custom parameter binding#[sqly(select)]
for custom SQL select expressions#[sqly(filter)]
for custom SQL filter expressions#[sqly(optional)]
for optional update and insert fields#[sqly(returning)]
for SQL RETURNING
clause#[sqly(distinct)]
for SQL DISTINCT
clause#[sqly(from, try_from, default)]
for table&[T]
Draft
#[sqly(group)]
for SQL GROUP BY
clause