keelson-gen 0.1.1

keelson's code generator: introspect a live schema, emit readable model .rs files against keelson-models.
Documentation
// @generated by keelson-gen. DO NOT EDIT.
// Regenerate from the schema instead; hand-written code (hooks included)
// belongs outside this directory.

/// The model marker `editable_users::view()` hangs off.
#[derive(Debug, Clone, Copy)]
pub struct EditableUsers;
/// One row of `editable_users`.
#[derive(Debug, Clone, PartialEq)]
pub struct EditableUser {
    pub id: Option<i64>,
    pub name: Option<String>,
    pub email: Option<String>,
}
impl keelson_exec::FromRow for EditableUser {
    fn from_row(row: &mut keelson_exec::Row) -> Result<Self, keelson_exec::ExecError> {
        Ok(EditableUser {
            id: row.take("id")?,
            name: row.take("name")?,
            email: row.take("email")?,
        })
    }
}
/// The entry point: `editable_users::view().query(…)` — a SELECT-only model.
pub fn view() -> keelson_models::ModelTable<EditableUsers> {
    keelson_models::ModelTable::new()
}
pub fn id() -> keelson_models::Column<i64> {
    keelson_models::Column::new("editable_users", "id")
}
pub fn name() -> keelson_models::Column<String> {
    keelson_models::Column::new("editable_users", "name")
}
pub fn email() -> keelson_models::Column<String> {
    keelson_models::Column::new("editable_users", "email")
}
#[allow(clippy::type_complexity)]
fn all_columns() -> (
    keelson_models::Column<i64>,
    keelson_models::Column<String>,
    keelson_models::Column<String>,
) {
    (id(), name(), email())
}
impl keelson_models::View for EditableUsers {
    type Row = EditableUser;
    type Select = keelson_sqlite::SelectQuery;
    fn base_select() -> Self::Select {
        keelson_sqlite::select((
            keelson_sqlite::select::columns(all_columns()),
            keelson_sqlite::select::from(keelson_sqlite::quote("editable_users")),
        ))
    }
}