Skip to content

1.0.0-rc.5

Pre-release
Pre-release
Compare
Choose a tag to compare
@tyt2y3 tyt2y3 released this 29 May 15:27
· 97 commits to master since this release

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