Skip to content

Commit

Permalink
Drop SelectTwoMany::one() method (SeaQL/sea-orm#813)
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 committed Jul 13, 2022
1 parent a559e3e commit 9a5a1cf
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions SeaORM/docs/05-basic-crud/01-select.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,24 @@ let cake_with_fruits: Vec<(cake::Model, Vec<fruit::Model>)> = Cake::find()
.await?;
```

> Since 0.9.0, `SelectTwoMany::one()` method has been dropped:
>
> ```rust
> let cake_with_fruits: Option<(cake::Model, Option<fruit::Model>)> = Cake::find()
> .find_with_related(Fruit)
> .one(db) // This method has been dropped
> .await?;
> ```
>
> `SelectTwoMany` is for selecting models of a one-to-many relationship
> but `SelectTwoMany::one()` returns `Option<(E, Option<F>)>`
> and the return value is a pair of models instead of `(E, Vec<F>)`
> which is a weird query result for a one-to-many relationship.
>
> Users are advised to query `(E, Vec<F>)` by first querying `E` from the database,
> then use `find_related` method to query `Vec<F>`.
> Read [lazy loading](#lazy-loading) for details.
## Paginate Result
Convert any SeaORM select into a [paginator](https://docs.rs/sea-orm/*/sea_orm/struct.Paginator.html) with custom page size.
Expand Down

0 comments on commit 9a5a1cf

Please sign in to comment.