MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / order_by

Method order_by

src/query/helper.rs:604–610  ·  view source on GitHub ↗

Add an order_by expression ``` use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend}; assert_eq!( cake::Entity::find() .order_by(cake::Column::Id, Order::Asc) .order_by(cake::Column::Name, Order::Desc) .build(DbBackend::MySql) .to_string(), "SELECT `cake`.`id`, `cake`.`name` FROM `cake` ORDER BY `cake`.`id` ASC, `cake`.`name` DESC" ); ```

(mut self, col: C, ord: Order)

Source from the content-addressed store, hash-verified

602 /// );
603 /// ```
604 fn order_by<C>(mut self, col: C, ord: Order) -> Self
605 where
606 C: IntoSimpleExpr,
607 {
608 self.query().order_by_expr(col.into_simple_expr(), ord);
609 self
610 }
611
612 /// Add an order_by expression (ascending)
613 /// ```

Callers 3

prepare_order_byMethod · 0.80
apply_order_byMethod · 0.80
get_migration_modelsMethod · 0.80

Implementers 1

cursor.rssrc/executor/cursor.rs

Calls 2

into_simple_exprMethod · 0.80
queryMethod · 0.45

Tested by

no test coverage detected