pub struct TableClient { /* private fields */ }Expand description
Table-scoped CRUD operations.
Implementations§
Source§impl TableClient
impl TableClient
Sourcepub fn model_name(&self) -> &str
pub fn model_name(&self) -> &str
The model name this client was opened with.
Sourcepub fn table_name(&self) -> &str
pub fn table_name(&self) -> &str
The resolved physical table name.
Sourcepub async fn find_many(&self, args: &FindManyArgs) -> Result<Vec<RowMap>>
pub async fn find_many(&self, args: &FindManyArgs) -> Result<Vec<RowMap>>
Fetch rows matching the structured args.
Sourcepub async fn find_first(&self, args: &FindManyArgs) -> Result<Option<RowMap>>
pub async fn find_first(&self, args: &FindManyArgs) -> Result<Option<RowMap>>
First row matching the args, or None.
Sourcepub async fn find_unique(&self, args: &FindManyArgs) -> Result<Option<RowMap>>
pub async fn find_unique(&self, args: &FindManyArgs) -> Result<Option<RowMap>>
Single row matching unique criteria.
Sourcepub async fn create(&self, data: &RowMap) -> Result<RowMap>
pub async fn create(&self, data: &RowMap) -> Result<RowMap>
Insert one row and return it.
Uses the dialect’s returning clause (OUTPUT INSERTED.* on SQL Server,
RETURNING * on PostgreSQL/SQLite) so database-generated columns such
as an auto-increment id come back populated. Falls back to the submitted
values when the engine does not support it.
Sourcepub async fn create_many(&self, data: &[RowMap]) -> Result<u64>
pub async fn create_many(&self, data: &[RowMap]) -> Result<u64>
Insert many rows, returning the number inserted.
Sourcepub async fn update(&self, args: &UpdateArgs) -> Result<u64>
pub async fn update(&self, args: &UpdateArgs) -> Result<u64>
Update rows matching where with data.
Sourcepub async fn update_many(&self, args: &UpdateManyArgs) -> Result<u64>
pub async fn update_many(&self, args: &UpdateManyArgs) -> Result<u64>
Alias of update kept for API parity with the other adapters.
Sourcepub async fn delete_many(&self, args: &DeleteManyArgs) -> Result<u64>
pub async fn delete_many(&self, args: &DeleteManyArgs) -> Result<u64>
Delete rows matching where.
Sourcepub async fn upsert(&self, args: &UpsertArgs) -> Result<RowMap>
pub async fn upsert(&self, args: &UpsertArgs) -> Result<RowMap>
Update when a match exists, otherwise insert.
Sourcepub async fn aggregate(&self, args: &AggregateArgs) -> Result<RowMap>
pub async fn aggregate(&self, args: &AggregateArgs) -> Result<RowMap>
Aggregations over matching rows.
Sourcepub async fn group_by(&self, args: &GroupByArgs) -> Result<Vec<RowMap>>
pub async fn group_by(&self, args: &GroupByArgs) -> Result<Vec<RowMap>>
Group rows by one or more columns.
Sourcepub async fn vector_search(
&self,
args: &VectorSearchArgs,
) -> Result<Vec<RowMap>>
pub async fn vector_search( &self, args: &VectorSearchArgs, ) -> Result<Vec<RowMap>>
Vector similarity search.
Tries the database’s native distance function first and falls back to in-memory scoring when the engine does not provide one, mirroring the behaviour of the Go and TypeScript adapters.
Sourcepub fn resolve_select_relations<'a>(
&'a self,
rows: &'a mut [RowMap],
select: &'a Value,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>
pub fn resolve_select_relations<'a>( &'a self, rows: &'a mut [RowMap], select: &'a Value, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>
Eager-loads the requested relations onto each row.
Boxed because eager loading re-enters find_many on the related table,
which would otherwise make this future infinitely sized.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TableClient
impl !UnwindSafe for TableClient
impl Freeze for TableClient
impl Send for TableClient
impl Sync for TableClient
impl Unpin for TableClient
impl UnsafeUnpin for TableClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more