Macro diesel::infer_table_from_schema [] [src]

macro_rules! infer_table_from_schema {
    ($database_url: expr, $table_name: expr) => { ... };

Establishes a database connection at compile time, loads the schema information about a table's columns, and invokes table! for you automatically. For tables in a schema other than the default, the table name should be given as "schema_name.table_name".

Attempting to use the env! or dotenv! macros here will not work due to limitations of the Macros 1.1 system, but you can pass a string in the form "env:SOME_ENV_VAR" or "dotenv:SOME_ENV_VAR" to achieve the same effect.

At this time, the schema inference macros do not support types from third party crates, and having any columns with a type not supported by the diesel core crate will result in a compiler error (please open an issue if this happens unexpectedly for a type listed in our docs.)

This macro can only be used in combination with the diesel_codegen or diesel_codegen_syntex crates. It will not work on its own.