1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
//! Everything related to table aliasing
//!
//! See [`alias!`](crate::alias!) for more details
mod alias;
mod aliased_field;
mod dsl_impls;
mod field_alias_mapper;
mod joins;
mod macros;
// This is reexported from the parent module
#[allow(unreachable_pub)]
pub use alias::Alias;
// This is reexported from the parent module
#[allow(unreachable_pub)]
#[doc(hidden)] // This is used by the table macro
pub use alias::{
AliasAliasAppearsInFromClause, AliasAliasAppearsInFromClauseSameTable, AliasAppearsInFromClause,
};
#[allow(unreachable_pub)]
pub use aliased_field::AliasedField;
#[allow(unreachable_pub)]
#[doc(hidden)] // This is used by the table macro
pub use field_alias_mapper::{FieldAliasMapper, FieldAliasMapperAssociatedTypesDisjointnessTrick};
/// Types created by the `alias!` macro that serve to distinguish between aliases implement
/// this trait.
///
/// In order to be able to implement within diesel a lot of traits on what will represent the alias,
/// we cannot use directly that new type within the query builder. Instead, we will use `Alias<S>`,
/// where `S: AliasSource`.
///
/// This trait should never be implemented by an end-user directly.
pub trait AliasSource {
/// The name of this alias in the query
const NAME: &'static str;
/// The table the alias maps to
type Target;
/// Obtain the table from the source
///
/// (used by Diesel to implement some traits)
fn target(&self) -> &Self::Target;
}