pub struct FindManyArgs {
pub where_: Option<Expr>,
pub order_by: Vec<OrderBy>,
pub take: Option<i32>,
pub skip: Option<u32>,
pub include: HashMap<String, IncludeRelation>,
pub select: HashMap<String, bool>,
pub cursor: Option<HashMap<String, Value>>,
pub distinct: Vec<String>,
pub nearest: Option<VectorNearest>,
}Expand description
Arguments accepted by find_many and find_first delegate methods.
All fields are optional and default to “no constraint”.
§Example
let args = FindManyArgs {
where_: Some(User::columns().email.eq("alice@example.com")),
take: Some(10),
..Default::default()
};
let users = client.user.find_many(args).await?;Fields§
§where_: Option<Expr>Optional WHERE filter expression.
order_by: Vec<OrderBy>ORDER BY clauses (applied in order).
take: Option<i32>Maximum number of rows to return (LIMIT).
Positive values paginate forward; negative values paginate
backward (reverses the result set in application code after
flipping ORDER BY directions — no DB-specific SQL needed).
Only meaningful when cursor is also set.
skip: Option<u32>Number of rows to skip (OFFSET), applied relative to the cursor position
when cursor is set, or from the start of the result set otherwise.
include: HashMap<String, IncludeRelation>Relations to eager-load, with optional per-relation filters.
Key is the relation field name (e.g. "posts"), value controls
how that relation is included (filter, etc.).
Cannot be used together with select.
select: HashMap<String, bool>Projection: only return the specified scalar fields.
Key is the field name (logical name), value must be true to include
the field. PK fields are always returned regardless. When empty, all
columns are returned.
Cannot be used together with include.
cursor: Option<HashMap<String, Value>>Cursor for stable (keyset) pagination.
A map of primary-key field name -> value that identifies the record
from which the page should start. When
combined with take / skip, they are applied relative to this anchor
record rather than from the absolute start of the table.
All primary-key fields of the model must be present in the map.
distinct: Vec<String>Columns to deduplicate on (SELECT DISTINCT / DISTINCT ON).
Specifying one or more field names activates column-level deduplication:
- Postgres: rendered as
SELECT DISTINCT ON (col, ...)with those columns automatically prepended toORDER BYas required by Postgres. - SQLite / MySQL: rendered as plain
SELECT DISTINCT(full-row deduplication — most effective when combined withselectprojection).
When empty (the default), no deduplication is applied.
nearest: Option<VectorNearest>Optional pgvector nearest-neighbor search.
When set, the engine orders the result set by vector distance on the
specified field. Callers must also provide a positive take so the
query remains bounded.
Trait Implementations§
Source§impl Clone for FindManyArgs
impl Clone for FindManyArgs
Source§fn clone(&self) -> FindManyArgs
fn clone(&self) -> FindManyArgs
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more