Struct diesel_dynamic_schema::Table
source · pub struct Table<T, U = T> { /* private fields */ }
Expand description
A database table.
A database table.
This type is created by the table
function.
Implementations§
Trait Implementations§
source§impl<T, U> AsQuery for Table<T, U>where
T: Clone,
U: Clone,
SelectStatement<FromClause<Self>>: Query<SqlType = NotSelectable>,
impl<T, U> AsQuery for Table<T, U>where T: Clone, U: Clone, SelectStatement<FromClause<Self>>: Query<SqlType = NotSelectable>,
§type SqlType = NotSelectable
type SqlType = NotSelectable
The SQL type of
Self::Query
§type Query = SelectStatement<FromClause<Table<T, U>>, DefaultSelectClause<FromClause<Table<T, U>>>, NoDistinctClause, NoWhereClause, NoOrderClause, LimitOffsetClause<NoLimitClause, NoOffsetClause>, NoGroupByClause, NoHavingClause, NoLockingClause>
type Query = SelectStatement<FromClause<Table<T, U>>, DefaultSelectClause<FromClause<Table<T, U>>>, NoDistinctClause, NoWhereClause, NoOrderClause, LimitOffsetClause<NoLimitClause, NoOffsetClause>, NoGroupByClause, NoHavingClause, NoLockingClause>
What kind of query does this type represent?
source§impl<T: PartialEq, U: PartialEq> PartialEq<Table<T, U>> for Table<T, U>
impl<T: PartialEq, U: PartialEq> PartialEq<Table<T, U>> for Table<T, U>
source§impl<T, U, DB> QueryFragment<DB, NotSpecialized> for Table<T, U>where
DB: Backend,
T: Borrow<str>,
U: Borrow<str>,
impl<T, U, DB> QueryFragment<DB, NotSpecialized> for Table<T, U>where DB: Backend, T: Borrow<str>, U: Borrow<str>,
source§fn walk_ast<'b>(&'b self, out: AstPass<'_, 'b, DB>) -> QueryResult<()>
fn walk_ast<'b>(&'b self, out: AstPass<'_, 'b, DB>) -> QueryResult<()>
Walk over this
QueryFragment
for all passes. Read moresource§fn to_sql(
&self,
out: &mut <DB as Backend>::QueryBuilder,
backend: &DB
) -> Result<(), Error>
fn to_sql( &self, out: &mut <DB as Backend>::QueryBuilder, backend: &DB ) -> Result<(), Error>
Available on crate feature
i-implement-a-third-party-backend-and-opt-into-breaking-changes
only.Converts this
QueryFragment
to its SQL representation. Read moresource§fn collect_binds<'b>(
&'b self,
out: &mut <DB as HasBindCollector<'b>>::BindCollector,
metadata_lookup: &mut <DB as TypeMetadata>::MetadataLookup,
backend: &'b DB
) -> Result<(), Error>
fn collect_binds<'b>( &'b self, out: &mut <DB as HasBindCollector<'b>>::BindCollector, metadata_lookup: &mut <DB as TypeMetadata>::MetadataLookup, backend: &'b DB ) -> Result<(), Error>
Available on crate feature
i-implement-a-third-party-backend-and-opt-into-breaking-changes
only.Serializes all bind parameters in this query. Read more
source§impl<T, U> QueryId for Table<T, U>
impl<T, U> QueryId for Table<T, U>
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<T, U> QuerySource for Table<T, U>where
Self: Clone,
impl<T, U> QuerySource for Table<T, U>where Self: Clone,
§type FromClause = Table<T, U>
type FromClause = Table<T, U>
The type returned by
from_clause
§type DefaultSelection = DummyExpression
type DefaultSelection = DummyExpression
The type returned by
default_selection
source§fn from_clause(&self) -> Self
fn from_clause(&self) -> Self
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<T, U> Table for Table<T, U>where
Self: QuerySource + AsQuery,
impl<T, U> Table for Table<T, U>where Self: QuerySource + AsQuery,
§type PrimaryKey = DummyExpression
type PrimaryKey = DummyExpression
The type returned by
primary_key
§type AllColumns = DummyExpression
type AllColumns = DummyExpression
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<T: Copy, U: Copy> Copy for Table<T, U>
impl<T: Eq, U: Eq> Eq for Table<T, U>
impl<T, U> StructuralEq for Table<T, U>
impl<T, U> StructuralPartialEq for Table<T, U>
Auto Trait Implementations§
impl<T, U> RefUnwindSafe for Table<T, U>where T: RefUnwindSafe, U: RefUnwindSafe,
impl<T, U> Send for Table<T, U>where T: Send, U: Send,
impl<T, U> Sync for Table<T, U>where T: Sync, U: Sync,
impl<T, U> Unpin for Table<T, U>where T: Unpin, U: Unpin,
impl<T, U> UnwindSafe for Table<T, U>where T: UnwindSafe, U: UnwindSafe,
Blanket Implementations§
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>where
Rhs: AsQuery<SqlType = <<T as CombineDsl>::Query as Query>::SqlType>,
fn union<Rhs>( self, rhs: Rhs ) -> CombinationClause<Union, Distinct, <T as CombineDsl>::Query, <Rhs as AsQuery>::Query>where Rhs: AsQuery<SqlType = <<T as CombineDsl>::Query as Query>::SqlType>,
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>where
Rhs: AsQuery<SqlType = <<T as CombineDsl>::Query as Query>::SqlType>,
fn union_all<Rhs>( self, rhs: Rhs ) -> CombinationClause<Union, All, <T as CombineDsl>::Query, <Rhs as AsQuery>::Query>where Rhs: AsQuery<SqlType = <<T as CombineDsl>::Query as Query>::SqlType>,
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>where
Rhs: AsQuery<SqlType = <<T as CombineDsl>::Query as Query>::SqlType>,
fn intersect<Rhs>( self, rhs: Rhs ) -> CombinationClause<Intersect, Distinct, <T as CombineDsl>::Query, <Rhs as AsQuery>::Query>where Rhs: AsQuery<SqlType = <<T as CombineDsl>::Query as Query>::SqlType>,
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>where
Rhs: AsQuery<SqlType = <<T as CombineDsl>::Query as Query>::SqlType>,
fn intersect_all<Rhs>( self, rhs: Rhs ) -> CombinationClause<Intersect, All, <T as CombineDsl>::Query, <Rhs as AsQuery>::Query>where Rhs: AsQuery<SqlType = <<T as CombineDsl>::Query as Query>::SqlType>,
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>where
Rhs: AsQuery<SqlType = <<T as CombineDsl>::Query as Query>::SqlType>,
fn except<Rhs>( self, rhs: Rhs ) -> CombinationClause<Except, Distinct, <T as CombineDsl>::Query, <Rhs as AsQuery>::Query>where Rhs: AsQuery<SqlType = <<T as CombineDsl>::Query as Query>::SqlType>,
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>where
Rhs: AsQuery<SqlType = <<T as CombineDsl>::Query as Query>::SqlType>,
fn except_all<Rhs>( self, rhs: Rhs ) -> CombinationClause<Except, All, <T as CombineDsl>::Query, <Rhs as AsQuery>::Query>where Rhs: AsQuery<SqlType = <<T as CombineDsl>::Query as Query>::SqlType>,
Combine two queries using a SQL
EXCEPT ALL
source§impl<Conn, DB, T> ExecuteDsl<Conn, DB> for Twhere
Conn: Connection<Backend = DB>,
DB: Backend,
T: QueryFragment<DB, NotSpecialized> + QueryId,
impl<Conn, DB, T> ExecuteDsl<Conn, DB> for Twhere Conn: Connection<Backend = DB>, DB: Backend, T: QueryFragment<DB, NotSpecialized> + QueryId,
source§impl<T> IntoSql for T
impl<T> IntoSql for T
source§fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
T: SqlType + TypedExpressionType,
fn into_sql<T>(self) -> Self::Expressionwhere Self: AsExpression<T> + Sized, T: SqlType + TypedExpressionType,
Convert
self
to an expression for Diesel’s query builder. Read moresource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
T: SqlType + TypedExpressionType,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,
Convert
&self
to an expression for Diesel’s query builder. Read moresource§impl<T> JoinOnDsl for Twhere
T: QuerySource,
impl<T> JoinOnDsl for Twhere T: QuerySource,
source§impl<Lhs, Rhs, On> JoinTo<OnClauseWrapper<Rhs, On>> for Lhswhere
Lhs: Table,
impl<Lhs, Rhs, On> JoinTo<OnClauseWrapper<Rhs, On>> for Lhswhere Lhs: Table,
type FromClause = Rhs
type OnClause = On
fn join_target( rhs: OnClauseWrapper<Rhs, On> ) -> (<Lhs as JoinTo<OnClauseWrapper<Rhs, On>>>::FromClause, <Lhs as JoinTo<OnClauseWrapper<Rhs, On>>>::OnClause)
source§impl<T> QueryDsl for Twhere
T: Table,
impl<T> QueryDsl for Twhere T: Table,
source§fn distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn distinct(self) -> Self::Outputwhere Self: DistinctDsl,
Adds the
DISTINCT
keyword to a query. Read moresource§fn distinct_on<Expr>(self, expr: Expr) -> Self::Outputwhere
Self: DistinctOnDsl<Expr>,
fn distinct_on<Expr>(self, expr: Expr) -> Self::Outputwhere Self: DistinctOnDsl<Expr>,
Adds the
DISTINCT ON
clause to a query. Read moresource§fn select<Selection>(self, selection: Selection) -> Self::Outputwhere
Selection: Expression,
Self: SelectDsl<Selection>,
fn select<Selection>(self, selection: Selection) -> Self::Outputwhere Selection: Expression, Self: SelectDsl<Selection>,
Adds a
SELECT
clause to the query. Read moresource§fn count(self) -> Self::Outputwhere
Self: SelectDsl<CountStar>,
fn count(self) -> Self::Outputwhere Self: SelectDsl<CountStar>,
Get the count of a query. This is equivalent to
.select(count_star())
Read moresource§fn inner_join<Rhs>(self, rhs: Rhs) -> Self::Outputwhere
Self: JoinWithImplicitOnClause<Rhs, Inner>,
fn inner_join<Rhs>(self, rhs: Rhs) -> Self::Outputwhere Self: JoinWithImplicitOnClause<Rhs, Inner>,
Join two tables using a SQL
INNER JOIN
. Read moresource§fn left_outer_join<Rhs>(self, rhs: Rhs) -> Self::Outputwhere
Self: JoinWithImplicitOnClause<Rhs, LeftOuter>,
fn left_outer_join<Rhs>(self, rhs: Rhs) -> Self::Outputwhere Self: JoinWithImplicitOnClause<Rhs, LeftOuter>,
Join two tables using a SQL
LEFT OUTER JOIN
. Read moresource§fn left_join<Rhs>(self, rhs: Rhs) -> Self::Outputwhere
Self: JoinWithImplicitOnClause<Rhs, LeftOuter>,
fn left_join<Rhs>(self, rhs: Rhs) -> Self::Outputwhere Self: JoinWithImplicitOnClause<Rhs, LeftOuter>,
Alias for
left_outer_join
.source§fn filter<Predicate>(self, predicate: Predicate) -> Self::Outputwhere
Self: FilterDsl<Predicate>,
fn filter<Predicate>(self, predicate: Predicate) -> Self::Outputwhere Self: FilterDsl<Predicate>,
Adds to the
WHERE
clause of a query. Read moresource§fn or_filter<Predicate>(self, predicate: Predicate) -> Self::Outputwhere
Self: OrFilterDsl<Predicate>,
fn or_filter<Predicate>(self, predicate: Predicate) -> Self::Outputwhere Self: OrFilterDsl<Predicate>,
source§fn find<PK>(self, id: PK) -> Self::Outputwhere
Self: FindDsl<PK>,
fn find<PK>(self, id: PK) -> Self::Outputwhere 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) -> Self::Outputwhere
Expr: Expression,
Self: OrderDsl<Expr>,
fn order<Expr>(self, expr: Expr) -> Self::Outputwhere Expr: Expression, Self: OrderDsl<Expr>,
Sets the order clause of a query. Read more
source§fn order_by<Expr>(self, expr: Expr) -> Self::Outputwhere
Expr: Expression,
Self: OrderDsl<Expr>,
fn order_by<Expr>(self, expr: Expr) -> Self::Outputwhere Expr: Expression, Self: OrderDsl<Expr>,
Alias for
order
source§fn then_order_by<Order>(self, order: Order) -> Self::Outputwhere
Self: ThenOrderDsl<Order>,
fn then_order_by<Order>(self, order: Order) -> Self::Outputwhere Self: ThenOrderDsl<Order>,
Appends to the
ORDER BY
clause of this SQL query. Read moresource§fn limit(self, limit: i64) -> Self::Outputwhere
Self: LimitDsl,
fn limit(self, limit: i64) -> Self::Outputwhere Self: LimitDsl,
Sets the limit clause of the query. Read more
source§fn offset(self, offset: i64) -> Self::Outputwhere
Self: OffsetDsl,
fn offset(self, offset: i64) -> Self::Outputwhere Self: OffsetDsl,
Sets the offset clause of the query. Read more
source§fn group_by<GB>(self, group_by: GB) -> Self::Outputwhere
GB: Expression,
Self: GroupByDsl<GB>,
fn group_by<GB>(self, group_by: GB) -> Self::Outputwhere GB: Expression, Self: GroupByDsl<GB>,
Sets the
group by
clause of a query. Read moresource§fn having<Predicate>(self, predicate: Predicate) -> Self::Outputwhere
Self: HavingDsl<Predicate>,
fn having<Predicate>(self, predicate: Predicate) -> Self::Outputwhere Self: HavingDsl<Predicate>,
Adds to the
HAVING
clause of a query. Read moresource§fn for_update(self) -> Self::Outputwhere
Self: LockingDsl<ForUpdate>,
fn for_update(self) -> Self::Outputwhere Self: LockingDsl<ForUpdate>,
Adds
FOR UPDATE
to the end of the select statement. Read moresource§fn for_no_key_update(self) -> Self::Outputwhere
Self: LockingDsl<ForNoKeyUpdate>,
fn for_no_key_update(self) -> Self::Outputwhere 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) -> Self::Outputwhere
Self: ModifyLockDsl<SkipLocked>,
fn skip_locked(self) -> Self::Outputwhere Self: ModifyLockDsl<SkipLocked>,
source§fn no_wait(self) -> Self::Outputwhere
Self: ModifyLockDsl<NoWait>,
fn no_wait(self) -> Self::Outputwhere Self: ModifyLockDsl<NoWait>,
source§fn into_boxed<'a, DB>(self) -> Self::Outputwhere
DB: Backend,
Self: BoxedDsl<'a, DB>,
fn into_boxed<'a, DB>(self) -> Self::Outputwhere DB: Backend, Self: BoxedDsl<'a, DB>,
Boxes the pieces of a query into a single type. Read more
source§fn single_value(self) -> Self::Outputwhere
Self: SingleValueDsl,
fn single_value(self) -> Self::Outputwhere Self: SingleValueDsl,
Wraps this select statement in parenthesis, allowing it to be used
as an expression. Read more
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) -> Result<usize, Error>where
Conn: Connection,
Self: ExecuteDsl<Conn, <Conn as Connection>::Backend>,
fn execute(self, conn: &mut Conn) -> Result<usize, Error>where Conn: Connection, Self: ExecuteDsl<Conn, <Conn as Connection>::Backend>,
Executes the given command, returning the number of rows affected. Read more
source§fn load<'query, U>(self, conn: &mut Conn) -> Result<Vec<U, Global>, Error>where
Self: LoadQuery<'query, Conn, U, DefaultLoadingMode>,
fn load<'query, U>(self, conn: &mut Conn) -> Result<Vec<U, Global>, Error>where Self: LoadQuery<'query, Conn, U, DefaultLoadingMode>,
source§fn load_iter<'conn, 'query, U, B>(
self,
conn: &'conn mut Conn
) -> Result<Self::Ret, Error>where
'query: 'conn,
U: 'conn,
Self: LoadQuery<'query, Conn, U, B> + 'conn,
fn load_iter<'conn, 'query, U, B>( self, conn: &'conn mut Conn ) -> Result<Self::Ret, Error>where 'query: 'conn, U: 'conn, Self: LoadQuery<'query, Conn, U, B> + 'conn,
source§fn get_result<'query, U>(self, conn: &mut Conn) -> Result<U, Error>where
Self: LoadQuery<'query, Conn, U, DefaultLoadingMode>,
fn get_result<'query, U>(self, conn: &mut Conn) -> Result<U, Error>where Self: LoadQuery<'query, Conn, U, DefaultLoadingMode>,
Runs the command, and returns the affected row. Read more