Query schemas not known at compile time with Diesel
Switch branches/tags
Nothing to show
Clone or download
Latest commit a8ec4fb Dec 4, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src run rust fmt on project Dec 3, 2018
tests run rust fmt on project Dec 3, 2018
.gitignore Initial May 23, 2018
.travis.yml traivs test cargo with feature flags Dec 3, 2018
Cargo.toml Add a licence for the crate Aug 21, 2018
LICENSE-APACHE Add a licence for the crate Aug 21, 2018
LICENSE-MIT Add a licence for the crate Aug 21, 2018
README.md Add a licence for the crate Aug 21, 2018

README.md

Query schemas not known at compile time with Diesel

Build Status Gitter

API Documentation: latest release

Diesel is built to provide strong compile time guarantees that your queries are valid. To do this, it needs to represent your schema at compile time. However, there are some times where you don't actually know the schema you're interacting with until runtime.

This crate provides tools to work with those cases, while still being able to use Diesel's query builder. Keep in mind that many compile time guarantees are lost. We cannot verify that the tables/columns you ask for actually exist, or that the types you state are correct.

Getting Started

The main function used by this crate is table. Note that you must always provide an explicit select clause when using this crate.

use diesel_dynamic_schema::table;

let users = table("users");
let id = users.column::<Integer, _>("id");
let name = users.column::<Text, _>("name");

users.select((id, name))
    .filter(name.eq("Sean"))
    .first(&conn)

Code of conduct

Anyone who interacts with Diesel in any space, including but not limited to this GitHub repository, must follow our code of conduct.

License

Licensed under either of these:

Contributing

Unless you explicitly state otherwise, any contribution you intentionally submit for inclusion in the work, as defined in the Apache-2.0 license, shall be dual-licensed as above, without any additional terms or conditions.