Files
2026-08-01 16:11:49 +03:00

2.9 KiB

Release Notes: sea-query 1.0.0-rc.33

(since 1.0.0-rc.32)

New Features

let value = sea_query::Enum {
    type_name: "FontSizeEnum".to_owned().into(),
    value: "large".into(),
};

assert_eq!(
    Query::insert()
        .into_table(Char::Table)
        .columns([Char::FontSize])
        .values_panic([Expr::val(value)])
        .to_string(PostgresQueryBuilder),
    r#"INSERT INTO "character" ("font_size") VALUES ('large'::"FontSizeEnum")"#
);

Arrays of enum values are also supported (requires postgres-array):

let value = Value::Array(
    ArrayType::Enum(Box::new("FontSizeEnum".to_owned().into())),
    Some(Box::new(vec![
        sea_query::Enum { type_name: "FontSizeEnum".to_owned().into(), value: "large".into() }.into(),
    ])),
);

// Generates: INSERT INTO "character" ("font_size") VALUES ($1::"FontSizeEnum"[])
assert_eq!(
    Query::select()
        .expr(PgFunc::advisory_lock(Expr::val(12345_i64)))
        .to_owned()
        .to_string(PostgresQueryBuilder),
    r#"SELECT PG_ADVISORY_LOCK(12345)"#
);

Full set of functions added: PgFunc::advisory_lock, advisory_lock_shared, try_advisory_lock, try_advisory_lock_shared, advisory_unlock, advisory_unlock_shared, advisory_unlock_all, advisory_xact_lock, advisory_xact_lock_shared, try_advisory_xact_lock, try_advisory_xact_lock_shared

// Attach alias directly on an expression
Query::select()
    .expr(Expr::col(Char::Character).alias("C"))
    .from(Char::Table);

// Chain window function inline
Query::select()
    .from(Char::Table)
    .expr(
        Expr::col(Char::Character)
            .max()
            .over(WindowStatement::partition_by(Char::FontSize))
            .alias("C"),
    );

// Reference a named window
Query::select()
    .from(Char::Table)
    .expr(Expr::col(Char::Character).max().over("w"))
    .window("w", WindowStatement::partition_by(Char::FontSize));

Enhancements

House Keeping

  • Simplify FunctionCall::new(PgFunc::...) calls