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

Method distinct

src/query/helper.rs:338–341  ·  view source on GitHub ↗

Add a DISTINCT expression ``` use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend}; struct Input { name: Option , } let input = Input { name: Some("cheese".to_owned()), }; assert_eq!( cake::Entity::find() .filter( Condition::all().add_option(input.name.map(|n| cake::Column::Name.contains(&n))) ) .distinct() .build(DbBackend::MySql) .to_string(), "SELECT DISTINCT `cake`.`id`, `cake

(mut self)

Source from the content-addressed store, hash-verified

336 /// );
337 /// ```
338 fn distinct(mut self) -> Self {
339 self.query().distinct();
340 self
341 }
342
343 /// Add a DISTINCT ON expression
344 /// NOTE: this function is only supported by `sqlx-postgres`

Callers

nothing calls this directly

Implementers 1

cursor.rssrc/executor/cursor.rs

Calls 1

queryMethod · 0.45

Tested by

no test coverage detected