github SeaQL/sea-orm 1.0.0-rc.5

latest releases: 1.1.1, 1.1.0, 1.1.0-rc.3...
pre-release5 months ago

New Features

  • Introduce PrimaryKeyArity with ARITY constant #2185
fn get_arity_of<E: EntityTrait>() -> usize {
    E::PrimaryKey::iter().count() // before; runtime
    <<E::PrimaryKey as PrimaryKeyTrait>::ValueType as PrimaryKeyArity>::ARITY // now; compile-time
}
  • Associate ActiveModel to EntityTrait #2186
  • [sea-orm-macros] Added rename_all attribute to DeriveEntityModel & DeriveActiveEnum #2170
#[derive(DeriveEntityModel)]
#[sea_orm(table_name = "user", rename_all = "camelCase")]
pub struct Model {
    #[sea_orm(primary_key)]
    id: i32,
    first_name: String, // firstName
    #[sea_orm(column_name = "lAsTnAmE")]
    last_name: String, // lAsTnAmE
}

#[derive(EnumIter, DeriveActiveEnum)]
#[sea_orm(rs_type = "String", db_type = "String(StringLen::None)", rename_all = "camelCase")]
pub enum TestEnum {
    DefaultVariant, // defaultVariant
    #[sea_orm(rename = "kebab-case")]
    VariantKebabCase, // variant-kebab-case
    #[sea_orm(rename = "snake_case")]
    VariantSnakeCase, // variant_snake_case
    #[sea_orm(string_value = "CuStOmStRiNgVaLuE")]
    CustomStringValue, // CuStOmStRiNgVaLuE
}

Enhancements

  • Added ActiveValue::set_if_not_equals() #2194
  • Added ActiveValue::try_as_ref() #2197
  • Added QuerySelect::order_by_with_nulls #2228
  • Expose get_xxx_connection_pool by default #2233

Don't miss a new sea-orm release

NewReleases is sending notifications on new releases.