pub struct Tablesample<S, TSM>where
TSM: TablesampleMethod,{ /* private fields */ }
Expand description
Represents a query with a TABLESAMPLE
clause.
Implementations§
source§impl<S, TSM> Tablesample<S, TSM>where
TSM: TablesampleMethod,
impl<S, TSM> Tablesample<S, TSM>where
TSM: TablesampleMethod,
sourcepub fn with_seed(self, seed: f64) -> Tablesample<S, TSM>
pub fn with_seed(self, seed: f64) -> Tablesample<S, TSM>
This method allows you to specify the random number generator seed to use in the sampling method. This allows you to obtain repeatable results.
Trait Implementations§
source§impl<S, TSM> AsQuery for Tablesample<S, TSM>where
S: Table + Clone,
TSM: TablesampleMethod,
<S as QuerySource>::DefaultSelection: ValidGrouping<()> + SelectableExpression<Tablesample<S, TSM>>,
impl<S, TSM> AsQuery for Tablesample<S, TSM>where
S: Table + Clone,
TSM: TablesampleMethod,
<S as QuerySource>::DefaultSelection: ValidGrouping<()> + SelectableExpression<Tablesample<S, TSM>>,
source§type SqlType = <<Tablesample<S, TSM> as QuerySource>::DefaultSelection as Expression>::SqlType
type SqlType = <<Tablesample<S, TSM> as QuerySource>::DefaultSelection as Expression>::SqlType
The SQL type of
Self::Query
source§type Query = SelectStatement<FromClause<Tablesample<S, TSM>>>
type Query = SelectStatement<FromClause<Tablesample<S, TSM>>>
What kind of query does this type represent?
source§impl<S: Clone, TSM> Clone for Tablesample<S, TSM>where
TSM: TablesampleMethod + Clone,
impl<S: Clone, TSM> Clone for Tablesample<S, TSM>where
TSM: TablesampleMethod + Clone,
source§fn clone(&self) -> Tablesample<S, TSM>
fn clone(&self) -> Tablesample<S, TSM>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<S, TSM> QueryFragment<Pg> for Tablesample<S, TSM>where
S: QueryFragment<Pg>,
TSM: TablesampleMethod,
impl<S, TSM> QueryFragment<Pg> for Tablesample<S, TSM>where
S: QueryFragment<Pg>,
TSM: TablesampleMethod,
source§fn walk_ast<'b>(&'b self, out: AstPass<'_, 'b, Pg>) -> QueryResult<()>
fn walk_ast<'b>(&'b self, out: AstPass<'_, 'b, Pg>) -> QueryResult<()>
Walk over this
QueryFragment
for all passes. Read moresource§fn to_sql(&self, out: &mut DB::QueryBuilder, backend: &DB) -> QueryResult<()>
fn to_sql(&self, out: &mut DB::QueryBuilder, backend: &DB) -> QueryResult<()>
Converts this
QueryFragment
to its SQL representation. Read moresource§fn collect_binds<'b>(
&'b self,
out: &mut DB::BindCollector<'b>,
metadata_lookup: &mut DB::MetadataLookup,
backend: &'b DB,
) -> QueryResult<()>
fn collect_binds<'b>( &'b self, out: &mut DB::BindCollector<'b>, metadata_lookup: &mut DB::MetadataLookup, backend: &'b DB, ) -> QueryResult<()>
Serializes all bind parameters in this query. Read more
source§fn is_safe_to_cache_prepared(&self, backend: &DB) -> QueryResult<bool>
fn is_safe_to_cache_prepared(&self, backend: &DB) -> QueryResult<bool>
Is this query safe to store in the prepared statement cache? Read more
source§impl<S, TSM> QueryId for Tablesample<S, TSM>where
S: QueryId,
TSM: TablesampleMethod,
impl<S, TSM> QueryId for Tablesample<S, TSM>where
S: QueryId,
TSM: TablesampleMethod,
source§const HAS_STATIC_QUERY_ID: bool = false
const HAS_STATIC_QUERY_ID: bool = false
Can the SQL generated by
Self
be uniquely identified by its type? Read moresource§impl<S, TSM> QuerySource for Tablesample<S, TSM>where
S: Table + Clone,
TSM: TablesampleMethod,
<S as QuerySource>::DefaultSelection: ValidGrouping<()> + SelectableExpression<Tablesample<S, TSM>>,
impl<S, TSM> QuerySource for Tablesample<S, TSM>where
S: Table + Clone,
TSM: TablesampleMethod,
<S as QuerySource>::DefaultSelection: ValidGrouping<()> + SelectableExpression<Tablesample<S, TSM>>,
source§type FromClause = Tablesample<S, TSM>
type FromClause = Tablesample<S, TSM>
The type returned by
from_clause
source§type DefaultSelection = <S as QuerySource>::DefaultSelection
type DefaultSelection = <S as QuerySource>::DefaultSelection
The type returned by
default_selection
source§fn from_clause(&self) -> Self::FromClause
fn from_clause(&self) -> Self::FromClause
The actual
FROM
clause of this type. This is typically only called in
QueryFragment
implementations.source§fn default_selection(&self) -> Self::DefaultSelection
fn default_selection(&self) -> Self::DefaultSelection
The default select clause of this type, which should be used if no
select clause was explicitly specified. This should always be a tuple of
all the desired columns, not
star
source§impl<S, TSM> Table for Tablesample<S, TSM>where
S: Table + Clone + AsQuery,
TSM: TablesampleMethod,
<S as Table>::PrimaryKey: SelectableExpression<Tablesample<S, TSM>>,
<S as Table>::AllColumns: SelectableExpression<Tablesample<S, TSM>>,
<S as QuerySource>::DefaultSelection: ValidGrouping<()> + SelectableExpression<Tablesample<S, TSM>>,
impl<S, TSM> Table for Tablesample<S, TSM>where
S: Table + Clone + AsQuery,
TSM: TablesampleMethod,
<S as Table>::PrimaryKey: SelectableExpression<Tablesample<S, TSM>>,
<S as Table>::AllColumns: SelectableExpression<Tablesample<S, TSM>>,
<S as QuerySource>::DefaultSelection: ValidGrouping<()> + SelectableExpression<Tablesample<S, TSM>>,
source§type PrimaryKey = <S as Table>::PrimaryKey
type PrimaryKey = <S as Table>::PrimaryKey
The type returned by
primary_key
source§type AllColumns = <S as Table>::AllColumns
type AllColumns = <S as Table>::AllColumns
The type returned by
all_columns
source§fn primary_key(&self) -> Self::PrimaryKey
fn primary_key(&self) -> Self::PrimaryKey
Returns the primary key of this table. Read more
source§fn all_columns() -> Self::AllColumns
fn all_columns() -> Self::AllColumns
Returns a tuple of all columns belonging to this table.
impl<S: Copy, TSM> Copy for Tablesample<S, TSM>where
TSM: TablesampleMethod + Copy,
impl<S, T, TSM> JoinTo<T> for Tablesample<S, TSM>
Auto Trait Implementations§
impl<S, TSM> Freeze for Tablesample<S, TSM>where
S: Freeze,
impl<S, TSM> RefUnwindSafe for Tablesample<S, TSM>where
S: RefUnwindSafe,
TSM: RefUnwindSafe,
impl<S, TSM> Send for Tablesample<S, TSM>
impl<S, TSM> Sync for Tablesample<S, TSM>
impl<S, TSM> Unpin for Tablesample<S, TSM>
impl<S, TSM> UnwindSafe for Tablesample<S, TSM>where
S: UnwindSafe,
TSM: UnwindSafe,
Blanket Implementations§
source§impl<T1, T2> AppearsInFromClause<T2> for T1
impl<T1, T2> AppearsInFromClause<T2> for T1
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CombineDsl for Twhere
T: Table,
impl<T> CombineDsl for Twhere
T: Table,
source§fn union<Rhs>(
self,
rhs: Rhs,
) -> CombinationClause<Union, Distinct, <T as CombineDsl>::Query, <Rhs as AsQuery>::Query>
fn union<Rhs>( self, rhs: Rhs, ) -> CombinationClause<Union, Distinct, <T as CombineDsl>::Query, <Rhs as AsQuery>::Query>
Combine two queries using a SQL
UNION
Read moresource§fn union_all<Rhs>(
self,
rhs: Rhs,
) -> CombinationClause<Union, All, <T as CombineDsl>::Query, <Rhs as AsQuery>::Query>
fn union_all<Rhs>( self, rhs: Rhs, ) -> CombinationClause<Union, All, <T as CombineDsl>::Query, <Rhs as AsQuery>::Query>
Combine two queries using a SQL
UNION ALL
source§fn intersect<Rhs>(
self,
rhs: Rhs,
) -> CombinationClause<Intersect, Distinct, <T as CombineDsl>::Query, <Rhs as AsQuery>::Query>
fn intersect<Rhs>( self, rhs: Rhs, ) -> CombinationClause<Intersect, Distinct, <T as CombineDsl>::Query, <Rhs as AsQuery>::Query>
Combine two queries using a SQL
INTERSECT
source§fn intersect_all<Rhs>(
self,
rhs: Rhs,
) -> CombinationClause<Intersect, All, <T as CombineDsl>::Query, <Rhs as AsQuery>::Query>
fn intersect_all<Rhs>( self, rhs: Rhs, ) -> CombinationClause<Intersect, All, <T as CombineDsl>::Query, <Rhs as AsQuery>::Query>
Combine two queries using a SQL
INTERSECT ALL
source§fn except<Rhs>(
self,
rhs: Rhs,
) -> CombinationClause<Except, Distinct, <T as CombineDsl>::Query, <Rhs as AsQuery>::Query>
fn except<Rhs>( self, rhs: Rhs, ) -> CombinationClause<Except, Distinct, <T as CombineDsl>::Query, <Rhs as AsQuery>::Query>
Combine two queries using a SQL
EXCEPT
source§fn except_all<Rhs>(
self,
rhs: Rhs,
) -> CombinationClause<Except, All, <T as CombineDsl>::Query, <Rhs as AsQuery>::Query>
fn except_all<Rhs>( self, rhs: Rhs, ) -> CombinationClause<Except, All, <T as CombineDsl>::Query, <Rhs as AsQuery>::Query>
Combine two queries using a SQL
EXCEPT ALL
source§impl<Conn, DB, T> ExecuteDsl<Conn, DB> for T
impl<Conn, DB, T> ExecuteDsl<Conn, DB> for T
source§impl<T> IntoSql for T
impl<T> IntoSql for T
source§impl<T> JoinOnDsl for Twhere
T: QuerySource,
impl<T> JoinOnDsl for Twhere
T: QuerySource,
source§impl<T> QueryDsl for Twhere
T: Table,
impl<T> QueryDsl for Twhere
T: Table,
source§fn distinct(self) -> Distinct<Self>where
Self: DistinctDsl,
fn distinct(self) -> Distinct<Self>where
Self: DistinctDsl,
Adds the
DISTINCT
keyword to a query. Read moresource§fn distinct_on<Expr>(self, expr: Expr) -> DistinctOn<Self, Expr>where
Self: DistinctOnDsl<Expr>,
fn distinct_on<Expr>(self, expr: Expr) -> DistinctOn<Self, Expr>where
Self: DistinctOnDsl<Expr>,
Adds the
DISTINCT ON
clause to a query. Read moresource§fn select<Selection>(self, selection: Selection) -> Select<Self, Selection>where
Selection: Expression,
Self: SelectDsl<Selection>,
fn select<Selection>(self, selection: Selection) -> Select<Self, Selection>where
Selection: Expression,
Self: SelectDsl<Selection>,
Adds a
SELECT
clause to the query. Read moresource§fn count(self) -> Select<Self, CountStar>
fn count(self) -> Select<Self, CountStar>
Get the count of a query. This is equivalent to
.select(count_star())
Read moresource§fn inner_join<Rhs>(self, rhs: Rhs) -> InnerJoin<Self, Rhs>where
Self: JoinWithImplicitOnClause<Rhs, Inner>,
fn inner_join<Rhs>(self, rhs: Rhs) -> InnerJoin<Self, Rhs>where
Self: JoinWithImplicitOnClause<Rhs, Inner>,
Join two tables using a SQL
INNER JOIN
. Read moresource§fn left_outer_join<Rhs>(self, rhs: Rhs) -> LeftJoin<Self, Rhs>where
Self: JoinWithImplicitOnClause<Rhs, LeftOuter>,
fn left_outer_join<Rhs>(self, rhs: Rhs) -> LeftJoin<Self, Rhs>where
Self: JoinWithImplicitOnClause<Rhs, LeftOuter>,
Join two tables using a SQL
LEFT OUTER JOIN
. Read moresource§fn left_join<Rhs>(self, rhs: Rhs) -> LeftJoin<Self, Rhs>where
Self: JoinWithImplicitOnClause<Rhs, LeftOuter>,
fn left_join<Rhs>(self, rhs: Rhs) -> LeftJoin<Self, Rhs>where
Self: JoinWithImplicitOnClause<Rhs, LeftOuter>,
Alias for
left_outer_join
.source§fn filter<Predicate>(self, predicate: Predicate) -> Filter<Self, Predicate>where
Self: FilterDsl<Predicate>,
fn filter<Predicate>(self, predicate: Predicate) -> Filter<Self, Predicate>where
Self: FilterDsl<Predicate>,
Adds to the
WHERE
clause of a query. Read moresource§fn or_filter<Predicate>(self, predicate: Predicate) -> OrFilter<Self, Predicate>where
Self: OrFilterDsl<Predicate>,
fn or_filter<Predicate>(self, predicate: Predicate) -> OrFilter<Self, Predicate>where
Self: OrFilterDsl<Predicate>,
source§fn find<PK>(self, id: PK) -> Find<Self, PK>where
Self: FindDsl<PK>,
fn find<PK>(self, id: PK) -> Find<Self, PK>where
Self: FindDsl<PK>,
Attempts to find a single record from the given table by primary key. Read more
source§fn order<Expr>(self, expr: Expr) -> Order<Self, Expr>where
Expr: Expression,
Self: OrderDsl<Expr>,
fn order<Expr>(self, expr: Expr) -> Order<Self, Expr>where
Expr: Expression,
Self: OrderDsl<Expr>,
Sets the order clause of a query. Read more
source§fn order_by<Expr>(self, expr: Expr) -> OrderBy<Self, Expr>where
Expr: Expression,
Self: OrderDsl<Expr>,
fn order_by<Expr>(self, expr: Expr) -> OrderBy<Self, Expr>where
Expr: Expression,
Self: OrderDsl<Expr>,
Alias for
order
source§fn then_order_by<Order>(self, order: Order) -> ThenOrderBy<Self, Order>where
Self: ThenOrderDsl<Order>,
fn then_order_by<Order>(self, order: Order) -> ThenOrderBy<Self, Order>where
Self: ThenOrderDsl<Order>,
Appends to the
ORDER BY
clause of this SQL query. Read moresource§fn limit(self, limit: i64) -> Limit<Self>where
Self: LimitDsl,
fn limit(self, limit: i64) -> Limit<Self>where
Self: LimitDsl,
Sets the limit clause of the query. Read more
source§fn offset(self, offset: i64) -> Offset<Self>where
Self: OffsetDsl,
fn offset(self, offset: i64) -> Offset<Self>where
Self: OffsetDsl,
Sets the offset clause of the query. Read more
source§fn group_by<GB>(self, group_by: GB) -> GroupBy<Self, GB>where
GB: Expression,
Self: GroupByDsl<GB>,
fn group_by<GB>(self, group_by: GB) -> GroupBy<Self, GB>where
GB: Expression,
Self: GroupByDsl<GB>,
Sets the
group by
clause of a query. Read moresource§fn having<Predicate>(self, predicate: Predicate) -> Having<Self, Predicate>where
Self: HavingDsl<Predicate>,
fn having<Predicate>(self, predicate: Predicate) -> Having<Self, Predicate>where
Self: HavingDsl<Predicate>,
Adds to the
HAVING
clause of a query. Read moresource§fn for_update(self) -> ForUpdate<Self>where
Self: LockingDsl<ForUpdate>,
fn for_update(self) -> ForUpdate<Self>where
Self: LockingDsl<ForUpdate>,
Adds
FOR UPDATE
to the end of the select statement. Read moresource§fn for_no_key_update(self) -> ForNoKeyUpdate<Self>where
Self: LockingDsl<ForNoKeyUpdate>,
fn for_no_key_update(self) -> ForNoKeyUpdate<Self>where
Self: LockingDsl<ForNoKeyUpdate>,
Adds
FOR NO KEY UPDATE
to the end of the select statement. Read moreAdds
FOR SHARE
to the end of the select statement. Read moreAdds
FOR KEY SHARE
to the end of the select statement. Read moresource§fn skip_locked(self) -> SkipLocked<Self>where
Self: ModifyLockDsl<SkipLocked>,
fn skip_locked(self) -> SkipLocked<Self>where
Self: ModifyLockDsl<SkipLocked>,
source§fn no_wait(self) -> NoWait<Self>where
Self: ModifyLockDsl<NoWait>,
fn no_wait(self) -> NoWait<Self>where
Self: ModifyLockDsl<NoWait>,
source§fn into_boxed<'a, DB>(self) -> IntoBoxed<'a, Self, DB>
fn into_boxed<'a, DB>(self) -> IntoBoxed<'a, Self, DB>
Boxes the pieces of a query into a single type. Read more
source§fn single_value(self) -> SingleValue<Self>where
Self: SingleValueDsl,
fn single_value(self) -> SingleValue<Self>where
Self: SingleValueDsl,
Wraps this select statement in parenthesis, allowing it to be used
as an expression. Read more
source§fn nullable(self) -> NullableSelect<Self>where
Self: SelectNullableDsl,
fn nullable(self) -> NullableSelect<Self>where
Self: SelectNullableDsl,
Coerce the SQL type of the select clause to it’s nullable equivalent. Read more
source§impl<T, DB> QueryFragmentForCachedStatement<DB> for T
impl<T, DB> QueryFragmentForCachedStatement<DB> for T
source§impl<T, Conn> RunQueryDsl<Conn> for Twhere
T: Table,
impl<T, Conn> RunQueryDsl<Conn> for Twhere
T: Table,
source§fn execute(self, conn: &mut Conn) -> QueryResult<usize>where
Conn: Connection,
Self: ExecuteDsl<Conn>,
fn execute(self, conn: &mut Conn) -> QueryResult<usize>where
Conn: Connection,
Self: ExecuteDsl<Conn>,
Executes the given command, returning the number of rows affected. Read more
source§fn load<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
fn load<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
source§fn load_iter<'conn, 'query: 'conn, U, B>(
self,
conn: &'conn mut Conn,
) -> QueryResult<Self::RowIter<'conn>>where
U: 'conn,
Self: LoadQuery<'query, Conn, U, B> + 'conn,
fn load_iter<'conn, 'query: 'conn, U, B>(
self,
conn: &'conn mut Conn,
) -> QueryResult<Self::RowIter<'conn>>where
U: 'conn,
Self: LoadQuery<'query, Conn, U, B> + 'conn,
source§fn get_result<'query, U>(self, conn: &mut Conn) -> QueryResult<U>where
Self: LoadQuery<'query, Conn, U>,
fn get_result<'query, U>(self, conn: &mut Conn) -> QueryResult<U>where
Self: LoadQuery<'query, Conn, U>,
Runs the command, and returns the affected row. Read more
source§fn get_results<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
fn get_results<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
Runs the command, returning an
Vec
with the affected rows. Read moresource§impl<T> TablesampleDsl for Twhere
T: Table,
impl<T> TablesampleDsl for Twhere
T: Table,
source§fn tablesample_bernoulli(
self,
portion: i16,
) -> Tablesample<Self, BernoulliMethod>
fn tablesample_bernoulli( self, portion: i16, ) -> Tablesample<Self, BernoulliMethod>
See the trait-level docs.
source§fn tablesample_system(self, portion: i16) -> Tablesample<Self, SystemMethod>
fn tablesample_system(self, portion: i16) -> Tablesample<Self, SystemMethod>
See the trait-level docs.