toql_rocket 0.1.3

Rocket integration for toql
Documentation

Toql Rocket

Description

Use Toql with Rocket. This crate adds:

  • Toql URL query parameters
  • HTTP response for Toql errors
  • load_many() function that works with URL query parameters
  • Response headers with count information

Snippet

--snip--
use toql_rocket::{Result, ToqlQuery, load_many, Counted, toql::sql_mapper::SqlMapperCache};

#[get("/?<toql..>")]
pub fn query( mappers: State<SqlMapperCache>, conn: ExampleDbConnection, toql: Form<ToqlQuery>) 
    -> Result<Counted<Json<Vec<User>>>> 
{
    let ExampleDbConnection(mut c) = conn;

    let r = load_many::<User>(&toql, &mappers, &mut c)?;
    Ok(Counted(Json(r.0), r.1))
}

Resources

Check out the CRUD example.

Installation

Add this to your Cargo.toml:

[dependencies]
toql_rocket = { version = "0.1", features= ["mysql"] }

License

Toql Rocket is distributed under the terms of both the MIT license and the Apache License (Version 2.0).