Powerful & expressive ORM/query-builder/static checker for raw queries/Fully Automated migration tooling , designed to offer an intuitive API, strict type-checking, novel features, & full specification support. It provides a fresh perspective in data management. Currently supports SurrealDB engine. RDMSs(PG, MYSQL etc) and others coming soon
85
stars
2
forks
source link
Support compile time checked query with query! macro #38
Support compile-time checked query with query! macro:
use surreal_orm::query;
#[test]
fn test_query_macro() {
let query = query!("SELECT name, age, * FROM users");
assert_eq!(query, "SELECT name, age, * FROM users");
}
#[test]
fn test_query_macro_with_params() {
let query = query!("SELECT name, age, * FROM users WHERE name = $1 AND name = 'Oyelowo'");
assert_eq!(
query,
"SELECT name, age, * FROM users WHERE name = $1 AND name = 'Oyelowo'"
);
}
#[test]
fn test_query_macro_with_graph() {
let query = query!("SELECT ->purchased->product<-purchased<-person->purchased->product FROM person:tobie PARALLEL");
assert_eq!(
query,
"SELECT ->purchased->product<-purchased<-person->purchased->product FROM person:tobie PARALLEL"
);
}
Description
Support compile-time checked query with
query!
macro: