Trait Schema

Source
pub trait Schema {
    // Required methods
    fn schema_postgres() -> &'static str;
    fn schema_sqlite() -> &'static str;

    // Provided method
    fn schema(pool: &Pool) -> &'static str { ... }
}

Required Methods§

Source

fn schema_postgres() -> &'static str

The generated table schema for PostgreSQL.

Source

fn schema_sqlite() -> &'static str

The generated table schema for SQLite.

§Examples

#[derive(db_derive::Table)]
#[table(schema)]
struct Tag {
    #[table(rename = "Id")]
    id: String,

    #[table(rename = "Name")]
    name: String,
}

assert_eq!("", Tag::schema_sqlite());

Provided Methods§

Source

fn schema(pool: &Pool) -> &'static str

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§