Debian Codegraph @

src/query_source/aliasing/mod.rs

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