Expand description
Exemplar is a boilerplate eliminator for rusqlite.
Getting Started
A taste of what you can do:
#[derive(Model)]
#[table("users")]
#[check("schema.sql")]
struct User {
username: String,
#[bind(bind_path)]
#[extr(extr_path)]
home_dir: PathBuf,
#[column("pwd")]
password: Vec<u8>,
}Exemplar is based around the Model trait, which has its own derive macro.
- See the aformentioned macro’s documentation to get started.
- For handling
enums in models, check out thesql_enummacro. - For working with “anonymous” record types, look at the
recordmacro.
Cargo Features
- (Default)
sql_enum- enables thesql_enummacro. Depends onnum_enum.
Macros
- Generate an “anonymous” record
structthat implementsfrom_row. - sql_enum
sql_enumGenerate an SQL-compatible field-lessenum.
Structs
- Metadata about a
Modelimplementor.
Enums
- Possible conflict resolution strategies when using
Model::insert_or. Cow-like type for query parameters.
Traits
- An interface for types that model database tables.
Type Aliases
- Type alias for the outcome of converting a value to an SQL-friendly representation.
- Type alias for the outcome of extracting a value from a
Row. - Type alias for a boxed slice of named query parameters.
Derive Macros
- Derive macro for the
Modeltrait.