Skip to main content

FindManyArgs

Struct FindManyArgs 

Source
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 to ORDER BY as required by Postgres.
  • SQLite / MySQL: rendered as plain SELECT DISTINCT (full-row deduplication — most effective when combined with select projection).

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

Source§

fn clone(&self) -> FindManyArgs

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FindManyArgs

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FindManyArgs

Source§

fn default() -> FindManyArgs

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.