This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/diesel-rs/diesel/blob/7ff5e6327d5e88095cb4b342da13bf06d6d0d1cd/examples/postgres/all_about_updates/src/lib.rs | |
// after running through `cargo expand` | |
#![feature(prelude_import)] | |
#[prelude_import] | |
use std::prelude::v1::*; | |
#[macro_use] | |
extern crate std; | |
use std::time::SystemTime; | |
use diesel::prelude::*; | |
pub mod posts { | |
#![allow(dead_code)] | |
use ::diesel::sql_types::*; | |
pub use self::columns::*; | |
/// Re-exports all of the columns of this table, as well as the | |
/// table struct renamed to the module name. This is meant to be | |
/// glob imported for functions which only deal with one table. | |
pub mod dsl { | |
pub use super::columns::{id}; | |
pub use super::columns::{title}; | |
pub use super::columns::{body}; | |
pub use super::columns::{draft}; | |
pub use super::columns::{publish_at}; | |
pub use super::columns::{visit_count}; | |
pub use super::table as posts; | |
} | |
#[allow(non_upper_case_globals, dead_code)] | |
/// A tuple of all of the columns on this table | |
pub const all_columns: (id, title, body, draft, publish_at, visit_count) = | |
(id, title, body, draft, publish_at, visit_count); | |
#[allow(non_camel_case_types)] | |
/// The actual table struct | |
/// | |
/// This is the type which provides the base methods of the query | |
/// builder, such as `.select` and `.filter`. | |
pub struct table; | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types)] | |
impl ::core::fmt::Debug for table { | |
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { | |
match *self { | |
table => { | |
let mut debug_trait_builder = f.debug_tuple("table"); | |
debug_trait_builder.finish() | |
} | |
} | |
} | |
} | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types)] | |
impl ::core::clone::Clone for table { | |
#[inline] | |
fn clone(&self) -> table { | |
{ | |
*self | |
} | |
} | |
} | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types)] | |
impl ::core::marker::Copy for table {} | |
#[allow(unused_imports)] | |
const _: () = { | |
use diesel; | |
use diesel::query_builder::QueryId; | |
#[allow(non_camel_case_types)] | |
impl QueryId for table { | |
type QueryId = table; | |
const HAS_STATIC_QUERY_ID: bool = true; | |
} | |
}; | |
impl table { | |
#[allow(dead_code)] | |
/// Represents `table_name.*`, which is sometimes necessary | |
/// for efficient count queries. It cannot be used in place of | |
/// `all_columns` | |
pub fn star(&self) -> star { | |
star | |
} | |
} | |
/// The SQL type of all of the columns on this table | |
pub type SqlType = (BigInt, Text, Text, Bool, Timestamp, Integer); | |
/// Helper type for representing a boxed query from this table | |
pub type BoxedQuery<'a, DB, ST = SqlType> = | |
::diesel::query_builder::BoxedSelectStatement<'a, ST, table, DB>; | |
impl ::diesel::QuerySource for table { | |
type FromClause = ::diesel::query_builder::nodes::Identifier<'static>; | |
type DefaultSelection = <Self as ::diesel::Table>::AllColumns; | |
fn from_clause(&self) -> Self::FromClause { | |
::diesel::query_builder::nodes::Identifier("posts") | |
} | |
fn default_selection(&self) -> Self::DefaultSelection { | |
use ::diesel::Table; | |
Self::all_columns() | |
} | |
} | |
impl ::diesel::query_builder::AsQuery for table { | |
type SqlType = SqlType; | |
type Query = ::diesel::query_builder::SelectStatement<Self>; | |
fn as_query(self) -> Self::Query { | |
::diesel::query_builder::SelectStatement::simple(self) | |
} | |
} | |
impl ::diesel::Table for table { | |
type PrimaryKey = id; | |
type AllColumns = (id, title, body, draft, publish_at, visit_count); | |
fn primary_key(&self) -> Self::PrimaryKey { | |
id | |
} | |
fn all_columns() -> Self::AllColumns { | |
(id, title, body, draft, publish_at, visit_count) | |
} | |
} | |
impl ::diesel::associations::HasTable for table { | |
type Table = Self; | |
fn table() -> Self::Table { | |
table | |
} | |
} | |
impl ::diesel::query_builder::IntoUpdateTarget for table { | |
type WhereClause = < < Self as :: diesel :: query_builder :: AsQuery > :: Query as :: diesel :: query_builder :: IntoUpdateTarget > :: WhereClause ; | |
fn into_update_target( | |
self, | |
) -> ::diesel::query_builder::UpdateTarget<Self::Table, Self::WhereClause> { | |
use ::diesel::query_builder::AsQuery; | |
self.as_query().into_update_target() | |
} | |
} | |
impl ::diesel::query_source::AppearsInFromClause<table> for table { | |
type Count = ::diesel::query_source::Once; | |
} | |
impl ::diesel::query_source::AppearsInFromClause<table> for () { | |
type Count = ::diesel::query_source::Never; | |
} | |
impl<Left, Right, Kind> ::diesel::JoinTo<::diesel::query_source::joins::Join<Left, Right, Kind>> | |
for table | |
where | |
::diesel::query_source::joins::Join<Left, Right, Kind>: ::diesel::JoinTo<table>, | |
{ | |
type FromClause = ::diesel::query_source::joins::Join<Left, Right, Kind>; | |
type OnClause = < :: diesel :: query_source :: joins :: Join < Left , Right , Kind > as :: diesel :: JoinTo < table > > :: OnClause ; | |
fn join_target( | |
rhs: ::diesel::query_source::joins::Join<Left, Right, Kind>, | |
) -> (Self::FromClause, Self::OnClause) { | |
let (_, on_clause) = ::diesel::query_source::joins::Join::join_target(table); | |
(rhs, on_clause) | |
} | |
} | |
impl<Join, On> ::diesel::JoinTo<::diesel::query_source::joins::JoinOn<Join, On>> for table | |
where | |
::diesel::query_source::joins::JoinOn<Join, On>: ::diesel::JoinTo<table>, | |
{ | |
type FromClause = ::diesel::query_source::joins::JoinOn<Join, On>; | |
type OnClause = | |
<::diesel::query_source::joins::JoinOn<Join, On> as ::diesel::JoinTo<table>>::OnClause; | |
fn join_target( | |
rhs: ::diesel::query_source::joins::JoinOn<Join, On>, | |
) -> (Self::FromClause, Self::OnClause) { | |
let (_, on_clause) = ::diesel::query_source::joins::JoinOn::join_target(table); | |
(rhs, on_clause) | |
} | |
} | |
impl<F, S, D, W, O, L, Of, G> | |
::diesel::JoinTo<::diesel::query_builder::SelectStatement<F, S, D, W, O, L, Of, G>> | |
for table | |
where | |
::diesel::query_builder::SelectStatement<F, S, D, W, O, L, Of, G>: ::diesel::JoinTo<table>, | |
{ | |
type FromClause = ::diesel::query_builder::SelectStatement<F, S, D, W, O, L, Of, G>; | |
type OnClause = < :: diesel :: query_builder :: SelectStatement < F , S , D , W , O , L , Of , G > as :: diesel :: JoinTo < table > > :: OnClause ; | |
fn join_target( | |
rhs: ::diesel::query_builder::SelectStatement<F, S, D, W, O, L, Of, G>, | |
) -> (Self::FromClause, Self::OnClause) { | |
let (_, on_clause) = ::diesel::query_builder::SelectStatement::join_target(table); | |
(rhs, on_clause) | |
} | |
} | |
impl<'a, QS, ST, DB> | |
::diesel::JoinTo<::diesel::query_builder::BoxedSelectStatement<'a, QS, ST, DB>> for table | |
where | |
::diesel::query_builder::BoxedSelectStatement<'a, QS, ST, DB>: ::diesel::JoinTo<table>, | |
{ | |
type FromClause = ::diesel::query_builder::BoxedSelectStatement<'a, QS, ST, DB>; | |
type OnClause = | |
<::diesel::query_builder::BoxedSelectStatement<'a, QS, ST, DB> as ::diesel::JoinTo< | |
table, | |
>>::OnClause; | |
fn join_target( | |
rhs: ::diesel::query_builder::BoxedSelectStatement<'a, QS, ST, DB>, | |
) -> (Self::FromClause, Self::OnClause) { | |
let (_, on_clause) = ::diesel::query_builder::BoxedSelectStatement::join_target(table); | |
(rhs, on_clause) | |
} | |
} | |
impl<T> ::diesel::insertable::Insertable<T> for table | |
where | |
<table as ::diesel::query_builder::AsQuery>::Query: ::diesel::insertable::Insertable<T>, | |
{ | |
type Values = < < table as :: diesel :: query_builder :: AsQuery > :: Query as :: diesel :: insertable :: Insertable < T > > :: Values ; | |
fn values(self) -> Self::Values { | |
use ::diesel::query_builder::AsQuery; | |
self.as_query().values() | |
} | |
} | |
impl<'a, T> ::diesel::insertable::Insertable<T> for &'a table | |
where | |
table: ::diesel::insertable::Insertable<T>, | |
{ | |
type Values = <table as ::diesel::insertable::Insertable<T>>::Values; | |
fn values(self) -> Self::Values { | |
(*self).values() | |
} | |
} | |
/// Contains all of the columns of this table | |
pub mod columns { | |
use super::table; | |
use ::diesel::sql_types::*; | |
#[allow(non_camel_case_types, dead_code)] | |
/// Represents `table_name.*`, which is sometimes needed for | |
/// efficient count queries. It cannot be used in place of | |
/// `all_columns`, and has a `SqlType` of `()` to prevent it | |
/// being used that way | |
pub struct star; | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::fmt::Debug for star { | |
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { | |
match *self { | |
star => { | |
let mut debug_trait_builder = f.debug_tuple("star"); | |
debug_trait_builder.finish() | |
} | |
} | |
} | |
} | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::clone::Clone for star { | |
#[inline] | |
fn clone(&self) -> star { | |
{ | |
*self | |
} | |
} | |
} | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::marker::Copy for star {} | |
#[allow(unused_imports)] | |
const _: () = { | |
use diesel; | |
use diesel::query_builder::QueryId; | |
#[allow(non_camel_case_types)] | |
impl QueryId for star { | |
type QueryId = star; | |
const HAS_STATIC_QUERY_ID: bool = true; | |
} | |
}; | |
impl<__GB> ::diesel::expression::ValidGrouping<__GB> for star | |
where | |
(id, title, body, draft, publish_at, visit_count): | |
::diesel::expression::ValidGrouping<__GB>, | |
{ | |
type IsAggregate = < ( id , title , body , draft , publish_at , visit_count ) as :: diesel :: expression :: ValidGrouping < __GB > > :: IsAggregate ; | |
} | |
impl ::diesel::Expression for star { | |
type SqlType = ::diesel::expression::expression_types::NotSelectable; | |
} | |
impl<DB: ::diesel::backend::Backend> ::diesel::query_builder::QueryFragment<DB> for star | |
where | |
<table as ::diesel::QuerySource>::FromClause: | |
::diesel::query_builder::QueryFragment<DB>, | |
{ | |
#[allow(non_snake_case)] | |
fn walk_ast( | |
&self, | |
mut __out: ::diesel::query_builder::AstPass<DB>, | |
) -> ::diesel::result::QueryResult<()> { | |
use ::diesel::QuerySource; | |
table.from_clause().walk_ast(__out.reborrow())?; | |
__out.push_sql(".*"); | |
Ok(()) | |
} | |
} | |
impl ::diesel::SelectableExpression<table> for star {} | |
impl ::diesel::AppearsOnTable<table> for star {} | |
#[allow(non_camel_case_types, dead_code)] | |
pub struct id; | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::fmt::Debug for id { | |
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { | |
match *self { | |
id => { | |
let mut debug_trait_builder = f.debug_tuple("id"); | |
debug_trait_builder.finish() | |
} | |
} | |
} | |
} | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::clone::Clone for id { | |
#[inline] | |
fn clone(&self) -> id { | |
{ | |
*self | |
} | |
} | |
} | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::marker::Copy for id {} | |
#[allow(unused_imports)] | |
const _: () = { | |
use diesel; | |
use diesel::query_builder::QueryId; | |
#[allow(non_camel_case_types)] | |
impl QueryId for id { | |
type QueryId = id; | |
const HAS_STATIC_QUERY_ID: bool = true; | |
} | |
}; | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::default::Default for id { | |
#[inline] | |
fn default() -> id { | |
id {} | |
} | |
} | |
impl ::diesel::expression::Expression for id { | |
type SqlType = BigInt; | |
} | |
impl<DB> ::diesel::query_builder::QueryFragment<DB> for id | |
where | |
DB: ::diesel::backend::Backend, | |
<table as ::diesel::QuerySource>::FromClause: | |
::diesel::query_builder::QueryFragment<DB>, | |
{ | |
#[allow(non_snake_case)] | |
fn walk_ast( | |
&self, | |
mut __out: ::diesel::query_builder::AstPass<DB>, | |
) -> ::diesel::result::QueryResult<()> { | |
use ::diesel::QuerySource; | |
table.from_clause().walk_ast(__out.reborrow())?; | |
__out.push_sql("."); | |
__out.push_identifier("id") | |
} | |
} | |
impl ::diesel::SelectableExpression<table> for id {} | |
impl<QS> ::diesel::AppearsOnTable<QS> for id where | |
QS: ::diesel::query_source::AppearsInFromClause< | |
table, | |
Count = ::diesel::query_source::Once, | |
> | |
{ | |
} | |
impl<Left, Right> | |
::diesel::SelectableExpression< | |
::diesel::query_source::joins::Join< | |
Left, | |
Right, | |
::diesel::query_source::joins::LeftOuter, | |
>, | |
> for id | |
where | |
id: ::diesel::AppearsOnTable< | |
::diesel::query_source::joins::Join< | |
Left, | |
Right, | |
::diesel::query_source::joins::LeftOuter, | |
>, | |
>, | |
Self: ::diesel::SelectableExpression<Left>, | |
Right: ::diesel::query_source::AppearsInFromClause< | |
table, | |
Count = ::diesel::query_source::Never, | |
>, | |
{ | |
} | |
impl < Left , Right > :: diesel :: SelectableExpression < :: diesel :: query_source :: joins :: Join < Left , Right , :: diesel :: query_source :: joins :: Inner > > for id where id : :: diesel :: AppearsOnTable < :: diesel :: query_source :: joins :: Join < Left , Right , :: diesel :: query_source :: joins :: Inner > > , Left : :: diesel :: query_source :: AppearsInFromClause < table > , Right : :: diesel :: query_source :: AppearsInFromClause < table > , ( Left :: Count , Right :: Count ) : :: diesel :: query_source :: Pick < Left , Right > , Self : :: diesel :: SelectableExpression < < ( Left :: Count , Right :: Count ) as :: diesel :: query_source :: Pick < Left , Right > > :: Selection > { } | |
impl<Join, On> | |
::diesel::SelectableExpression<::diesel::query_source::joins::JoinOn<Join, On>> for id | |
where | |
id: ::diesel::SelectableExpression<Join> | |
+ ::diesel::AppearsOnTable<::diesel::query_source::joins::JoinOn<Join, On>>, | |
{ | |
} | |
impl<From> ::diesel::SelectableExpression<::diesel::query_builder::SelectStatement<From>> for id where | |
id: ::diesel::SelectableExpression<From> | |
+ ::diesel::AppearsOnTable<::diesel::query_builder::SelectStatement<From>> | |
{ | |
} | |
impl<__GB> ::diesel::expression::ValidGrouping<__GB> for id | |
where | |
__GB: ::diesel::expression::IsContainedInGroupBy< | |
id, | |
Output = ::diesel::expression::is_contained_in_group_by::Yes, | |
>, | |
{ | |
type IsAggregate = ::diesel::expression::is_aggregate::Yes; | |
} | |
impl ::diesel::expression::ValidGrouping<()> for id { | |
type IsAggregate = ::diesel::expression::is_aggregate::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<id> for id { | |
type Output = ::diesel::expression::is_contained_in_group_by::Yes; | |
} | |
impl ::diesel::query_source::Column for id { | |
type Table = table; | |
const NAME: &'static str = "id"; | |
} | |
impl<T> ::diesel::EqAll<T> for id | |
where | |
T: ::diesel::expression::AsExpression<BigInt>, | |
::diesel::dsl::Eq<id, T::Expression>: | |
::diesel::Expression<SqlType = ::diesel::sql_types::Bool>, | |
{ | |
type Output = ::diesel::dsl::Eq<Self, T::Expression>; | |
fn eq_all(self, rhs: T) -> Self::Output { | |
use ::diesel::expression_methods::ExpressionMethods; | |
self.eq(rhs) | |
} | |
} | |
impl<Rhs> ::std::ops::Add<Rhs> for id | |
where | |
Rhs: ::diesel::expression::AsExpression< | |
<<id as ::diesel::Expression>::SqlType as ::diesel::sql_types::ops::Add>::Rhs, | |
>, | |
{ | |
type Output = ::diesel::expression::ops::Add<Self, Rhs::Expression>; | |
fn add(self, rhs: Rhs) -> Self::Output { | |
::diesel::expression::ops::Add::new(self, rhs.as_expression()) | |
} | |
} | |
impl<Rhs> ::std::ops::Sub<Rhs> for id | |
where | |
Rhs: ::diesel::expression::AsExpression< | |
<<id as ::diesel::Expression>::SqlType as ::diesel::sql_types::ops::Sub>::Rhs, | |
>, | |
{ | |
type Output = ::diesel::expression::ops::Sub<Self, Rhs::Expression>; | |
fn sub(self, rhs: Rhs) -> Self::Output { | |
::diesel::expression::ops::Sub::new(self, rhs.as_expression()) | |
} | |
} | |
impl<Rhs> ::std::ops::Div<Rhs> for id | |
where | |
Rhs: ::diesel::expression::AsExpression< | |
<<id as ::diesel::Expression>::SqlType as ::diesel::sql_types::ops::Div>::Rhs, | |
>, | |
{ | |
type Output = ::diesel::expression::ops::Div<Self, Rhs::Expression>; | |
fn div(self, rhs: Rhs) -> Self::Output { | |
::diesel::expression::ops::Div::new(self, rhs.as_expression()) | |
} | |
} | |
impl<Rhs> ::std::ops::Mul<Rhs> for id | |
where | |
Rhs: ::diesel::expression::AsExpression< | |
<<id as ::diesel::Expression>::SqlType as ::diesel::sql_types::ops::Mul>::Rhs, | |
>, | |
{ | |
type Output = ::diesel::expression::ops::Mul<Self, Rhs::Expression>; | |
fn mul(self, rhs: Rhs) -> Self::Output { | |
::diesel::expression::ops::Mul::new(self, rhs.as_expression()) | |
} | |
} | |
#[allow(non_camel_case_types, dead_code)] | |
pub struct title; | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::fmt::Debug for title { | |
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { | |
match *self { | |
title => { | |
let mut debug_trait_builder = f.debug_tuple("title"); | |
debug_trait_builder.finish() | |
} | |
} | |
} | |
} | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::clone::Clone for title { | |
#[inline] | |
fn clone(&self) -> title { | |
{ | |
*self | |
} | |
} | |
} | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::marker::Copy for title {} | |
#[allow(unused_imports)] | |
const _: () = { | |
use diesel; | |
use diesel::query_builder::QueryId; | |
#[allow(non_camel_case_types)] | |
impl QueryId for title { | |
type QueryId = title; | |
const HAS_STATIC_QUERY_ID: bool = true; | |
} | |
}; | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::default::Default for title { | |
#[inline] | |
fn default() -> title { | |
title {} | |
} | |
} | |
impl ::diesel::expression::Expression for title { | |
type SqlType = Text; | |
} | |
impl<DB> ::diesel::query_builder::QueryFragment<DB> for title | |
where | |
DB: ::diesel::backend::Backend, | |
<table as ::diesel::QuerySource>::FromClause: | |
::diesel::query_builder::QueryFragment<DB>, | |
{ | |
#[allow(non_snake_case)] | |
fn walk_ast( | |
&self, | |
mut __out: ::diesel::query_builder::AstPass<DB>, | |
) -> ::diesel::result::QueryResult<()> { | |
use ::diesel::QuerySource; | |
table.from_clause().walk_ast(__out.reborrow())?; | |
__out.push_sql("."); | |
__out.push_identifier("title") | |
} | |
} | |
impl ::diesel::SelectableExpression<table> for title {} | |
impl<QS> ::diesel::AppearsOnTable<QS> for title where | |
QS: ::diesel::query_source::AppearsInFromClause< | |
table, | |
Count = ::diesel::query_source::Once, | |
> | |
{ | |
} | |
impl<Left, Right> | |
::diesel::SelectableExpression< | |
::diesel::query_source::joins::Join< | |
Left, | |
Right, | |
::diesel::query_source::joins::LeftOuter, | |
>, | |
> for title | |
where | |
title: ::diesel::AppearsOnTable< | |
::diesel::query_source::joins::Join< | |
Left, | |
Right, | |
::diesel::query_source::joins::LeftOuter, | |
>, | |
>, | |
Self: ::diesel::SelectableExpression<Left>, | |
Right: ::diesel::query_source::AppearsInFromClause< | |
table, | |
Count = ::diesel::query_source::Never, | |
>, | |
{ | |
} | |
impl < Left , Right > :: diesel :: SelectableExpression < :: diesel :: query_source :: joins :: Join < Left , Right , :: diesel :: query_source :: joins :: Inner > > for title where title : :: diesel :: AppearsOnTable < :: diesel :: query_source :: joins :: Join < Left , Right , :: diesel :: query_source :: joins :: Inner > > , Left : :: diesel :: query_source :: AppearsInFromClause < table > , Right : :: diesel :: query_source :: AppearsInFromClause < table > , ( Left :: Count , Right :: Count ) : :: diesel :: query_source :: Pick < Left , Right > , Self : :: diesel :: SelectableExpression < < ( Left :: Count , Right :: Count ) as :: diesel :: query_source :: Pick < Left , Right > > :: Selection > { } | |
impl<Join, On> | |
::diesel::SelectableExpression<::diesel::query_source::joins::JoinOn<Join, On>> | |
for title | |
where | |
title: ::diesel::SelectableExpression<Join> | |
+ ::diesel::AppearsOnTable<::diesel::query_source::joins::JoinOn<Join, On>>, | |
{ | |
} | |
impl<From> ::diesel::SelectableExpression<::diesel::query_builder::SelectStatement<From>> for title where | |
title: ::diesel::SelectableExpression<From> | |
+ ::diesel::AppearsOnTable<::diesel::query_builder::SelectStatement<From>> | |
{ | |
} | |
impl<__GB> ::diesel::expression::ValidGrouping<__GB> for title | |
where | |
__GB: ::diesel::expression::IsContainedInGroupBy< | |
title, | |
Output = ::diesel::expression::is_contained_in_group_by::Yes, | |
>, | |
{ | |
type IsAggregate = ::diesel::expression::is_aggregate::Yes; | |
} | |
impl ::diesel::expression::ValidGrouping<()> for title { | |
type IsAggregate = ::diesel::expression::is_aggregate::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<title> for title { | |
type Output = ::diesel::expression::is_contained_in_group_by::Yes; | |
} | |
impl ::diesel::query_source::Column for title { | |
type Table = table; | |
const NAME: &'static str = "title"; | |
} | |
impl<T> ::diesel::EqAll<T> for title | |
where | |
T: ::diesel::expression::AsExpression<Text>, | |
::diesel::dsl::Eq<title, T::Expression>: | |
::diesel::Expression<SqlType = ::diesel::sql_types::Bool>, | |
{ | |
type Output = ::diesel::dsl::Eq<Self, T::Expression>; | |
fn eq_all(self, rhs: T) -> Self::Output { | |
use ::diesel::expression_methods::ExpressionMethods; | |
self.eq(rhs) | |
} | |
} | |
#[allow(non_camel_case_types, dead_code)] | |
pub struct body; | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::fmt::Debug for body { | |
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { | |
match *self { | |
body => { | |
let mut debug_trait_builder = f.debug_tuple("body"); | |
debug_trait_builder.finish() | |
} | |
} | |
} | |
} | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::clone::Clone for body { | |
#[inline] | |
fn clone(&self) -> body { | |
{ | |
*self | |
} | |
} | |
} | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::marker::Copy for body {} | |
#[allow(unused_imports)] | |
const _: () = { | |
use diesel; | |
use diesel::query_builder::QueryId; | |
#[allow(non_camel_case_types)] | |
impl QueryId for body { | |
type QueryId = body; | |
const HAS_STATIC_QUERY_ID: bool = true; | |
} | |
}; | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::default::Default for body { | |
#[inline] | |
fn default() -> body { | |
body {} | |
} | |
} | |
impl ::diesel::expression::Expression for body { | |
type SqlType = Text; | |
} | |
impl<DB> ::diesel::query_builder::QueryFragment<DB> for body | |
where | |
DB: ::diesel::backend::Backend, | |
<table as ::diesel::QuerySource>::FromClause: | |
::diesel::query_builder::QueryFragment<DB>, | |
{ | |
#[allow(non_snake_case)] | |
fn walk_ast( | |
&self, | |
mut __out: ::diesel::query_builder::AstPass<DB>, | |
) -> ::diesel::result::QueryResult<()> { | |
use ::diesel::QuerySource; | |
table.from_clause().walk_ast(__out.reborrow())?; | |
__out.push_sql("."); | |
__out.push_identifier("body") | |
} | |
} | |
impl ::diesel::SelectableExpression<table> for body {} | |
impl<QS> ::diesel::AppearsOnTable<QS> for body where | |
QS: ::diesel::query_source::AppearsInFromClause< | |
table, | |
Count = ::diesel::query_source::Once, | |
> | |
{ | |
} | |
impl<Left, Right> | |
::diesel::SelectableExpression< | |
::diesel::query_source::joins::Join< | |
Left, | |
Right, | |
::diesel::query_source::joins::LeftOuter, | |
>, | |
> for body | |
where | |
body: ::diesel::AppearsOnTable< | |
::diesel::query_source::joins::Join< | |
Left, | |
Right, | |
::diesel::query_source::joins::LeftOuter, | |
>, | |
>, | |
Self: ::diesel::SelectableExpression<Left>, | |
Right: ::diesel::query_source::AppearsInFromClause< | |
table, | |
Count = ::diesel::query_source::Never, | |
>, | |
{ | |
} | |
impl < Left , Right > :: diesel :: SelectableExpression < :: diesel :: query_source :: joins :: Join < Left , Right , :: diesel :: query_source :: joins :: Inner > > for body where body : :: diesel :: AppearsOnTable < :: diesel :: query_source :: joins :: Join < Left , Right , :: diesel :: query_source :: joins :: Inner > > , Left : :: diesel :: query_source :: AppearsInFromClause < table > , Right : :: diesel :: query_source :: AppearsInFromClause < table > , ( Left :: Count , Right :: Count ) : :: diesel :: query_source :: Pick < Left , Right > , Self : :: diesel :: SelectableExpression < < ( Left :: Count , Right :: Count ) as :: diesel :: query_source :: Pick < Left , Right > > :: Selection > { } | |
impl<Join, On> | |
::diesel::SelectableExpression<::diesel::query_source::joins::JoinOn<Join, On>> for body | |
where | |
body: ::diesel::SelectableExpression<Join> | |
+ ::diesel::AppearsOnTable<::diesel::query_source::joins::JoinOn<Join, On>>, | |
{ | |
} | |
impl<From> ::diesel::SelectableExpression<::diesel::query_builder::SelectStatement<From>> for body where | |
body: ::diesel::SelectableExpression<From> | |
+ ::diesel::AppearsOnTable<::diesel::query_builder::SelectStatement<From>> | |
{ | |
} | |
impl<__GB> ::diesel::expression::ValidGrouping<__GB> for body | |
where | |
__GB: ::diesel::expression::IsContainedInGroupBy< | |
body, | |
Output = ::diesel::expression::is_contained_in_group_by::Yes, | |
>, | |
{ | |
type IsAggregate = ::diesel::expression::is_aggregate::Yes; | |
} | |
impl ::diesel::expression::ValidGrouping<()> for body { | |
type IsAggregate = ::diesel::expression::is_aggregate::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<body> for body { | |
type Output = ::diesel::expression::is_contained_in_group_by::Yes; | |
} | |
impl ::diesel::query_source::Column for body { | |
type Table = table; | |
const NAME: &'static str = "body"; | |
} | |
impl<T> ::diesel::EqAll<T> for body | |
where | |
T: ::diesel::expression::AsExpression<Text>, | |
::diesel::dsl::Eq<body, T::Expression>: | |
::diesel::Expression<SqlType = ::diesel::sql_types::Bool>, | |
{ | |
type Output = ::diesel::dsl::Eq<Self, T::Expression>; | |
fn eq_all(self, rhs: T) -> Self::Output { | |
use ::diesel::expression_methods::ExpressionMethods; | |
self.eq(rhs) | |
} | |
} | |
#[allow(non_camel_case_types, dead_code)] | |
pub struct draft; | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::fmt::Debug for draft { | |
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { | |
match *self { | |
draft => { | |
let mut debug_trait_builder = f.debug_tuple("draft"); | |
debug_trait_builder.finish() | |
} | |
} | |
} | |
} | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::clone::Clone for draft { | |
#[inline] | |
fn clone(&self) -> draft { | |
{ | |
*self | |
} | |
} | |
} | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::marker::Copy for draft {} | |
#[allow(unused_imports)] | |
const _: () = { | |
use diesel; | |
use diesel::query_builder::QueryId; | |
#[allow(non_camel_case_types)] | |
impl QueryId for draft { | |
type QueryId = draft; | |
const HAS_STATIC_QUERY_ID: bool = true; | |
} | |
}; | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::default::Default for draft { | |
#[inline] | |
fn default() -> draft { | |
draft {} | |
} | |
} | |
impl ::diesel::expression::Expression for draft { | |
type SqlType = Bool; | |
} | |
impl<DB> ::diesel::query_builder::QueryFragment<DB> for draft | |
where | |
DB: ::diesel::backend::Backend, | |
<table as ::diesel::QuerySource>::FromClause: | |
::diesel::query_builder::QueryFragment<DB>, | |
{ | |
#[allow(non_snake_case)] | |
fn walk_ast( | |
&self, | |
mut __out: ::diesel::query_builder::AstPass<DB>, | |
) -> ::diesel::result::QueryResult<()> { | |
use ::diesel::QuerySource; | |
table.from_clause().walk_ast(__out.reborrow())?; | |
__out.push_sql("."); | |
__out.push_identifier("draft") | |
} | |
} | |
impl ::diesel::SelectableExpression<table> for draft {} | |
impl<QS> ::diesel::AppearsOnTable<QS> for draft where | |
QS: ::diesel::query_source::AppearsInFromClause< | |
table, | |
Count = ::diesel::query_source::Once, | |
> | |
{ | |
} | |
impl<Left, Right> | |
::diesel::SelectableExpression< | |
::diesel::query_source::joins::Join< | |
Left, | |
Right, | |
::diesel::query_source::joins::LeftOuter, | |
>, | |
> for draft | |
where | |
draft: ::diesel::AppearsOnTable< | |
::diesel::query_source::joins::Join< | |
Left, | |
Right, | |
::diesel::query_source::joins::LeftOuter, | |
>, | |
>, | |
Self: ::diesel::SelectableExpression<Left>, | |
Right: ::diesel::query_source::AppearsInFromClause< | |
table, | |
Count = ::diesel::query_source::Never, | |
>, | |
{ | |
} | |
impl < Left , Right > :: diesel :: SelectableExpression < :: diesel :: query_source :: joins :: Join < Left , Right , :: diesel :: query_source :: joins :: Inner > > for draft where draft : :: diesel :: AppearsOnTable < :: diesel :: query_source :: joins :: Join < Left , Right , :: diesel :: query_source :: joins :: Inner > > , Left : :: diesel :: query_source :: AppearsInFromClause < table > , Right : :: diesel :: query_source :: AppearsInFromClause < table > , ( Left :: Count , Right :: Count ) : :: diesel :: query_source :: Pick < Left , Right > , Self : :: diesel :: SelectableExpression < < ( Left :: Count , Right :: Count ) as :: diesel :: query_source :: Pick < Left , Right > > :: Selection > { } | |
impl<Join, On> | |
::diesel::SelectableExpression<::diesel::query_source::joins::JoinOn<Join, On>> | |
for draft | |
where | |
draft: ::diesel::SelectableExpression<Join> | |
+ ::diesel::AppearsOnTable<::diesel::query_source::joins::JoinOn<Join, On>>, | |
{ | |
} | |
impl<From> ::diesel::SelectableExpression<::diesel::query_builder::SelectStatement<From>> for draft where | |
draft: ::diesel::SelectableExpression<From> | |
+ ::diesel::AppearsOnTable<::diesel::query_builder::SelectStatement<From>> | |
{ | |
} | |
impl<__GB> ::diesel::expression::ValidGrouping<__GB> for draft | |
where | |
__GB: ::diesel::expression::IsContainedInGroupBy< | |
draft, | |
Output = ::diesel::expression::is_contained_in_group_by::Yes, | |
>, | |
{ | |
type IsAggregate = ::diesel::expression::is_aggregate::Yes; | |
} | |
impl ::diesel::expression::ValidGrouping<()> for draft { | |
type IsAggregate = ::diesel::expression::is_aggregate::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<draft> for draft { | |
type Output = ::diesel::expression::is_contained_in_group_by::Yes; | |
} | |
impl ::diesel::query_source::Column for draft { | |
type Table = table; | |
const NAME: &'static str = "draft"; | |
} | |
impl<T> ::diesel::EqAll<T> for draft | |
where | |
T: ::diesel::expression::AsExpression<Bool>, | |
::diesel::dsl::Eq<draft, T::Expression>: | |
::diesel::Expression<SqlType = ::diesel::sql_types::Bool>, | |
{ | |
type Output = ::diesel::dsl::Eq<Self, T::Expression>; | |
fn eq_all(self, rhs: T) -> Self::Output { | |
use ::diesel::expression_methods::ExpressionMethods; | |
self.eq(rhs) | |
} | |
} | |
#[allow(non_camel_case_types, dead_code)] | |
pub struct publish_at; | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::fmt::Debug for publish_at { | |
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { | |
match *self { | |
publish_at => { | |
let mut debug_trait_builder = f.debug_tuple("publish_at"); | |
debug_trait_builder.finish() | |
} | |
} | |
} | |
} | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::clone::Clone for publish_at { | |
#[inline] | |
fn clone(&self) -> publish_at { | |
{ | |
*self | |
} | |
} | |
} | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::marker::Copy for publish_at {} | |
#[allow(unused_imports)] | |
const _: () = { | |
use diesel; | |
use diesel::query_builder::QueryId; | |
#[allow(non_camel_case_types)] | |
impl QueryId for publish_at { | |
type QueryId = publish_at; | |
const HAS_STATIC_QUERY_ID: bool = true; | |
} | |
}; | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::default::Default for publish_at { | |
#[inline] | |
fn default() -> publish_at { | |
publish_at {} | |
} | |
} | |
impl ::diesel::expression::Expression for publish_at { | |
type SqlType = Timestamp; | |
} | |
impl<DB> ::diesel::query_builder::QueryFragment<DB> for publish_at | |
where | |
DB: ::diesel::backend::Backend, | |
<table as ::diesel::QuerySource>::FromClause: | |
::diesel::query_builder::QueryFragment<DB>, | |
{ | |
#[allow(non_snake_case)] | |
fn walk_ast( | |
&self, | |
mut __out: ::diesel::query_builder::AstPass<DB>, | |
) -> ::diesel::result::QueryResult<()> { | |
use ::diesel::QuerySource; | |
table.from_clause().walk_ast(__out.reborrow())?; | |
__out.push_sql("."); | |
__out.push_identifier("publish_at") | |
} | |
} | |
impl ::diesel::SelectableExpression<table> for publish_at {} | |
impl<QS> ::diesel::AppearsOnTable<QS> for publish_at where | |
QS: ::diesel::query_source::AppearsInFromClause< | |
table, | |
Count = ::diesel::query_source::Once, | |
> | |
{ | |
} | |
impl<Left, Right> | |
::diesel::SelectableExpression< | |
::diesel::query_source::joins::Join< | |
Left, | |
Right, | |
::diesel::query_source::joins::LeftOuter, | |
>, | |
> for publish_at | |
where | |
publish_at: ::diesel::AppearsOnTable< | |
::diesel::query_source::joins::Join< | |
Left, | |
Right, | |
::diesel::query_source::joins::LeftOuter, | |
>, | |
>, | |
Self: ::diesel::SelectableExpression<Left>, | |
Right: ::diesel::query_source::AppearsInFromClause< | |
table, | |
Count = ::diesel::query_source::Never, | |
>, | |
{ | |
} | |
impl < Left , Right > :: diesel :: SelectableExpression < :: diesel :: query_source :: joins :: Join < Left , Right , :: diesel :: query_source :: joins :: Inner > > for publish_at where publish_at : :: diesel :: AppearsOnTable < :: diesel :: query_source :: joins :: Join < Left , Right , :: diesel :: query_source :: joins :: Inner > > , Left : :: diesel :: query_source :: AppearsInFromClause < table > , Right : :: diesel :: query_source :: AppearsInFromClause < table > , ( Left :: Count , Right :: Count ) : :: diesel :: query_source :: Pick < Left , Right > , Self : :: diesel :: SelectableExpression < < ( Left :: Count , Right :: Count ) as :: diesel :: query_source :: Pick < Left , Right > > :: Selection > { } | |
impl<Join, On> | |
::diesel::SelectableExpression<::diesel::query_source::joins::JoinOn<Join, On>> | |
for publish_at | |
where | |
publish_at: ::diesel::SelectableExpression<Join> | |
+ ::diesel::AppearsOnTable<::diesel::query_source::joins::JoinOn<Join, On>>, | |
{ | |
} | |
impl<From> ::diesel::SelectableExpression<::diesel::query_builder::SelectStatement<From>> | |
for publish_at | |
where | |
publish_at: ::diesel::SelectableExpression<From> | |
+ ::diesel::AppearsOnTable<::diesel::query_builder::SelectStatement<From>>, | |
{ | |
} | |
impl<__GB> ::diesel::expression::ValidGrouping<__GB> for publish_at | |
where | |
__GB: ::diesel::expression::IsContainedInGroupBy< | |
publish_at, | |
Output = ::diesel::expression::is_contained_in_group_by::Yes, | |
>, | |
{ | |
type IsAggregate = ::diesel::expression::is_aggregate::Yes; | |
} | |
impl ::diesel::expression::ValidGrouping<()> for publish_at { | |
type IsAggregate = ::diesel::expression::is_aggregate::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<publish_at> for publish_at { | |
type Output = ::diesel::expression::is_contained_in_group_by::Yes; | |
} | |
impl ::diesel::query_source::Column for publish_at { | |
type Table = table; | |
const NAME: &'static str = "publish_at"; | |
} | |
impl<T> ::diesel::EqAll<T> for publish_at | |
where | |
T: ::diesel::expression::AsExpression<Timestamp>, | |
::diesel::dsl::Eq<publish_at, T::Expression>: | |
::diesel::Expression<SqlType = ::diesel::sql_types::Bool>, | |
{ | |
type Output = ::diesel::dsl::Eq<Self, T::Expression>; | |
fn eq_all(self, rhs: T) -> Self::Output { | |
use ::diesel::expression_methods::ExpressionMethods; | |
self.eq(rhs) | |
} | |
} | |
impl < Rhs > :: std :: ops :: Add < Rhs > for publish_at where Rhs : :: diesel :: expression :: AsExpression < < < publish_at as :: diesel :: Expression > :: SqlType as :: diesel :: sql_types :: ops :: Add > :: Rhs > { type Output = :: diesel :: expression :: ops :: Add < Self , Rhs :: Expression > ; fn add ( self , rhs : Rhs ) -> Self :: Output { :: diesel :: expression :: ops :: Add :: new ( self , rhs . as_expression ( ) ) } } | |
impl < Rhs > :: std :: ops :: Sub < Rhs > for publish_at where Rhs : :: diesel :: expression :: AsExpression < < < publish_at as :: diesel :: Expression > :: SqlType as :: diesel :: sql_types :: ops :: Sub > :: Rhs > { type Output = :: diesel :: expression :: ops :: Sub < Self , Rhs :: Expression > ; fn sub ( self , rhs : Rhs ) -> Self :: Output { :: diesel :: expression :: ops :: Sub :: new ( self , rhs . as_expression ( ) ) } } | |
#[allow(non_camel_case_types, dead_code)] | |
pub struct visit_count; | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::fmt::Debug for visit_count { | |
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { | |
match *self { | |
visit_count => { | |
let mut debug_trait_builder = f.debug_tuple("visit_count"); | |
debug_trait_builder.finish() | |
} | |
} | |
} | |
} | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::clone::Clone for visit_count { | |
#[inline] | |
fn clone(&self) -> visit_count { | |
{ | |
*self | |
} | |
} | |
} | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::marker::Copy for visit_count {} | |
#[allow(unused_imports)] | |
const _: () = { | |
use diesel; | |
use diesel::query_builder::QueryId; | |
#[allow(non_camel_case_types)] | |
impl QueryId for visit_count { | |
type QueryId = visit_count; | |
const HAS_STATIC_QUERY_ID: bool = true; | |
} | |
}; | |
#[automatically_derived] | |
#[allow(unused_qualifications)] | |
#[allow(non_camel_case_types, dead_code)] | |
impl ::core::default::Default for visit_count { | |
#[inline] | |
fn default() -> visit_count { | |
visit_count {} | |
} | |
} | |
impl ::diesel::expression::Expression for visit_count { | |
type SqlType = Integer; | |
} | |
impl<DB> ::diesel::query_builder::QueryFragment<DB> for visit_count | |
where | |
DB: ::diesel::backend::Backend, | |
<table as ::diesel::QuerySource>::FromClause: | |
::diesel::query_builder::QueryFragment<DB>, | |
{ | |
#[allow(non_snake_case)] | |
fn walk_ast( | |
&self, | |
mut __out: ::diesel::query_builder::AstPass<DB>, | |
) -> ::diesel::result::QueryResult<()> { | |
use ::diesel::QuerySource; | |
table.from_clause().walk_ast(__out.reborrow())?; | |
__out.push_sql("."); | |
__out.push_identifier("visit_count") | |
} | |
} | |
impl ::diesel::SelectableExpression<table> for visit_count {} | |
impl<QS> ::diesel::AppearsOnTable<QS> for visit_count where | |
QS: ::diesel::query_source::AppearsInFromClause< | |
table, | |
Count = ::diesel::query_source::Once, | |
> | |
{ | |
} | |
impl<Left, Right> | |
::diesel::SelectableExpression< | |
::diesel::query_source::joins::Join< | |
Left, | |
Right, | |
::diesel::query_source::joins::LeftOuter, | |
>, | |
> for visit_count | |
where | |
visit_count: ::diesel::AppearsOnTable< | |
::diesel::query_source::joins::Join< | |
Left, | |
Right, | |
::diesel::query_source::joins::LeftOuter, | |
>, | |
>, | |
Self: ::diesel::SelectableExpression<Left>, | |
Right: ::diesel::query_source::AppearsInFromClause< | |
table, | |
Count = ::diesel::query_source::Never, | |
>, | |
{ | |
} | |
impl < Left , Right > :: diesel :: SelectableExpression < :: diesel :: query_source :: joins :: Join < Left , Right , :: diesel :: query_source :: joins :: Inner > > for visit_count where visit_count : :: diesel :: AppearsOnTable < :: diesel :: query_source :: joins :: Join < Left , Right , :: diesel :: query_source :: joins :: Inner > > , Left : :: diesel :: query_source :: AppearsInFromClause < table > , Right : :: diesel :: query_source :: AppearsInFromClause < table > , ( Left :: Count , Right :: Count ) : :: diesel :: query_source :: Pick < Left , Right > , Self : :: diesel :: SelectableExpression < < ( Left :: Count , Right :: Count ) as :: diesel :: query_source :: Pick < Left , Right > > :: Selection > { } | |
impl<Join, On> | |
::diesel::SelectableExpression<::diesel::query_source::joins::JoinOn<Join, On>> | |
for visit_count | |
where | |
visit_count: ::diesel::SelectableExpression<Join> | |
+ ::diesel::AppearsOnTable<::diesel::query_source::joins::JoinOn<Join, On>>, | |
{ | |
} | |
impl<From> ::diesel::SelectableExpression<::diesel::query_builder::SelectStatement<From>> | |
for visit_count | |
where | |
visit_count: ::diesel::SelectableExpression<From> | |
+ ::diesel::AppearsOnTable<::diesel::query_builder::SelectStatement<From>>, | |
{ | |
} | |
impl<__GB> ::diesel::expression::ValidGrouping<__GB> for visit_count | |
where | |
__GB: ::diesel::expression::IsContainedInGroupBy< | |
visit_count, | |
Output = ::diesel::expression::is_contained_in_group_by::Yes, | |
>, | |
{ | |
type IsAggregate = ::diesel::expression::is_aggregate::Yes; | |
} | |
impl ::diesel::expression::ValidGrouping<()> for visit_count { | |
type IsAggregate = ::diesel::expression::is_aggregate::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<visit_count> for visit_count { | |
type Output = ::diesel::expression::is_contained_in_group_by::Yes; | |
} | |
impl ::diesel::query_source::Column for visit_count { | |
type Table = table; | |
const NAME: &'static str = "visit_count"; | |
} | |
impl<T> ::diesel::EqAll<T> for visit_count | |
where | |
T: ::diesel::expression::AsExpression<Integer>, | |
::diesel::dsl::Eq<visit_count, T::Expression>: | |
::diesel::Expression<SqlType = ::diesel::sql_types::Bool>, | |
{ | |
type Output = ::diesel::dsl::Eq<Self, T::Expression>; | |
fn eq_all(self, rhs: T) -> Self::Output { | |
use ::diesel::expression_methods::ExpressionMethods; | |
self.eq(rhs) | |
} | |
} | |
impl < Rhs > :: std :: ops :: Add < Rhs > for visit_count where Rhs : :: diesel :: expression :: AsExpression < < < visit_count as :: diesel :: Expression > :: SqlType as :: diesel :: sql_types :: ops :: Add > :: Rhs > { type Output = :: diesel :: expression :: ops :: Add < Self , Rhs :: Expression > ; fn add ( self , rhs : Rhs ) -> Self :: Output { :: diesel :: expression :: ops :: Add :: new ( self , rhs . as_expression ( ) ) } } | |
impl < Rhs > :: std :: ops :: Sub < Rhs > for visit_count where Rhs : :: diesel :: expression :: AsExpression < < < visit_count as :: diesel :: Expression > :: SqlType as :: diesel :: sql_types :: ops :: Sub > :: Rhs > { type Output = :: diesel :: expression :: ops :: Sub < Self , Rhs :: Expression > ; fn sub ( self , rhs : Rhs ) -> Self :: Output { :: diesel :: expression :: ops :: Sub :: new ( self , rhs . as_expression ( ) ) } } | |
impl < Rhs > :: std :: ops :: Div < Rhs > for visit_count where Rhs : :: diesel :: expression :: AsExpression < < < visit_count as :: diesel :: Expression > :: SqlType as :: diesel :: sql_types :: ops :: Div > :: Rhs > { type Output = :: diesel :: expression :: ops :: Div < Self , Rhs :: Expression > ; fn div ( self , rhs : Rhs ) -> Self :: Output { :: diesel :: expression :: ops :: Div :: new ( self , rhs . as_expression ( ) ) } } | |
impl < Rhs > :: std :: ops :: Mul < Rhs > for visit_count where Rhs : :: diesel :: expression :: AsExpression < < < visit_count as :: diesel :: Expression > :: SqlType as :: diesel :: sql_types :: ops :: Mul > :: Rhs > { type Output = :: diesel :: expression :: ops :: Mul < Self , Rhs :: Expression > ; fn mul ( self , rhs : Rhs ) -> Self :: Output { :: diesel :: expression :: ops :: Mul :: new ( self , rhs . as_expression ( ) ) } } | |
impl ::diesel::expression::IsContainedInGroupBy<title> for id { | |
type Output = ::diesel::expression::is_contained_in_group_by::Yes; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<id> for title { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<body> for id { | |
type Output = ::diesel::expression::is_contained_in_group_by::Yes; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<id> for body { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<draft> for id { | |
type Output = ::diesel::expression::is_contained_in_group_by::Yes; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<id> for draft { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<publish_at> for id { | |
type Output = ::diesel::expression::is_contained_in_group_by::Yes; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<id> for publish_at { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<visit_count> for id { | |
type Output = ::diesel::expression::is_contained_in_group_by::Yes; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<id> for visit_count { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<body> for title { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<title> for body { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<draft> for title { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<title> for draft { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<publish_at> for title { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<title> for publish_at { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<visit_count> for title { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<title> for visit_count { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<draft> for body { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<body> for draft { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<publish_at> for body { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<body> for publish_at { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<visit_count> for body { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<body> for visit_count { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<publish_at> for draft { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<draft> for publish_at { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<visit_count> for draft { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<draft> for visit_count { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<visit_count> for publish_at { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
impl ::diesel::expression::IsContainedInGroupBy<publish_at> for visit_count { | |
type Output = ::diesel::expression::is_contained_in_group_by::No; | |
} | |
} | |
} | |
pub struct Post { | |
pub id: i64, | |
pub title: String, | |
pub body: String, | |
pub draft: bool, | |
pub publish_at: SystemTime, | |
pub visit_count: i32, | |
} | |
#[allow(unused_imports)] | |
const _: () = { | |
use diesel; | |
use diesel::deserialize::{self, FromStaticSqlRow, Queryable}; | |
use diesel::row::{Row, Field}; | |
use std::convert::TryInto; | |
impl<__DB: diesel::backend::Backend, __ST0, __ST1, __ST2, __ST3, __ST4, __ST5> | |
Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5), __DB> for Post | |
where | |
(i64, String, String, bool, SystemTime, i32): | |
FromStaticSqlRow<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5), __DB>, | |
{ | |
type Row = (i64, String, String, bool, SystemTime, i32); | |
fn build(row: Self::Row) -> deserialize::Result<Self> { | |
Ok(Self { | |
id: (row.0.try_into()?), | |
title: (row.1.try_into()?), | |
body: (row.2.try_into()?), | |
draft: (row.3.try_into()?), | |
publish_at: (row.4.try_into()?), | |
visit_count: (row.5.try_into()?), | |
}) | |
} | |
} | |
}; | |
#[allow(unused_imports)] | |
const _: () = { | |
use diesel; | |
use diesel::associations::{HasTable, Identifiable}; | |
impl HasTable for Post { | |
type Table = posts::table; | |
fn table() -> Self::Table { | |
posts::table | |
} | |
} | |
impl<'ident> Identifiable for &'ident Post { | |
type Id = (&'ident i64); | |
fn id(self) -> Self::Id { | |
(&self.id) | |
} | |
} | |
}; | |
#[allow(unused_imports)] | |
const _: () = { | |
use diesel; | |
use diesel::query_builder::AsChangeset; | |
use diesel::prelude::*; | |
impl<'update> AsChangeset for &'update Post { | |
type Target = posts::table; | |
type Changeset = <( | |
diesel::dsl::Eq<posts::title, &'update String>, | |
diesel::dsl::Eq<posts::body, &'update String>, | |
diesel::dsl::Eq<posts::draft, &'update bool>, | |
diesel::dsl::Eq<posts::publish_at, &'update SystemTime>, | |
diesel::dsl::Eq<posts::visit_count, &'update i32>, | |
) as AsChangeset>::Changeset; | |
fn as_changeset(self) -> Self::Changeset { | |
( | |
posts::title.eq(&self.title), | |
posts::body.eq(&self.body), | |
posts::draft.eq(&self.draft), | |
posts::publish_at.eq(&self.publish_at), | |
posts::visit_count.eq(&self.visit_count), | |
) | |
.as_changeset() | |
} | |
} | |
impl<'update> AsChangeset for Post { | |
type Target = posts::table; | |
type Changeset = <( | |
diesel::dsl::Eq<posts::title, String>, | |
diesel::dsl::Eq<posts::body, String>, | |
diesel::dsl::Eq<posts::draft, bool>, | |
diesel::dsl::Eq<posts::publish_at, SystemTime>, | |
diesel::dsl::Eq<posts::visit_count, i32>, | |
) as AsChangeset>::Changeset; | |
fn as_changeset(self) -> Self::Changeset { | |
( | |
posts::title.eq(self.title), | |
posts::body.eq(self.body), | |
posts::draft.eq(self.draft), | |
posts::publish_at.eq(self.publish_at), | |
posts::visit_count.eq(self.visit_count), | |
) | |
.as_changeset() | |
} | |
} | |
}; | |
pub fn publish_all_posts(conn: &PgConnection) -> QueryResult<usize> { | |
use crate::posts::dsl::*; | |
diesel::update(posts).set(draft.eq(false)).execute(conn) | |
} | |
pub fn publish_pending_posts(conn: &PgConnection) -> QueryResult<usize> { | |
use crate::posts::dsl::*; | |
use diesel::dsl::now; | |
diesel::update(posts) | |
.filter(publish_at.lt(now)) | |
.set(draft.eq(false)) | |
.execute(conn) | |
} | |
pub fn publish_post(post: &Post, conn: &PgConnection) -> QueryResult<usize> { | |
diesel::update(post) | |
.set(posts::draft.eq(false)) | |
.execute(conn) | |
} | |
pub fn increment_visit_counts(conn: &PgConnection) -> QueryResult<usize> { | |
use crate::posts::dsl::*; | |
diesel::update(posts) | |
.set(visit_count.eq(visit_count + 1)) | |
.execute(conn) | |
} | |
pub fn hide_everything(conn: &PgConnection) -> QueryResult<usize> { | |
use crate::posts::dsl::*; | |
diesel::update(posts) | |
.set(( | |
title.eq("[REDACTED]"), | |
body.eq("This post has been classified"), | |
)) | |
.execute(conn) | |
} | |
pub fn update_from_post_fields(post: &Post, conn: &PgConnection) -> QueryResult<usize> { | |
diesel::update(posts::table).set(post).execute(conn) | |
} | |
pub fn update_with_option(conn: &PgConnection) -> QueryResult<usize> { | |
#[table_name = "posts"] | |
struct PostForm<'a> { | |
title: Option<&'a str>, | |
body: Option<&'a str>, | |
} | |
#[allow(unused_imports)] | |
const _: () = { | |
use diesel; | |
use diesel::query_builder::AsChangeset; | |
use diesel::prelude::*; | |
impl<'a, 'update> AsChangeset for &'update PostForm<'a> { | |
type Target = posts::table; | |
type Changeset = <( | |
std::option::Option<diesel::dsl::Eq<posts::title, &'update &'a str>>, | |
std::option::Option<diesel::dsl::Eq<posts::body, &'update &'a str>>, | |
) as AsChangeset>::Changeset; | |
fn as_changeset(self) -> Self::Changeset { | |
( | |
self.title.as_ref().map(|x| posts::title.eq(x)), | |
self.body.as_ref().map(|x| posts::body.eq(x)), | |
) | |
.as_changeset() | |
} | |
} | |
impl<'a, 'update> AsChangeset for PostForm<'a> { | |
type Target = posts::table; | |
type Changeset = <( | |
std::option::Option<diesel::dsl::Eq<posts::title, &'a str>>, | |
std::option::Option<diesel::dsl::Eq<posts::body, &'a str>>, | |
) as AsChangeset>::Changeset; | |
fn as_changeset(self) -> Self::Changeset { | |
( | |
self.title.map(|x| posts::title.eq(x)), | |
self.body.map(|x| posts::body.eq(x)), | |
) | |
.as_changeset() | |
} | |
} | |
}; | |
diesel::update(posts::table) | |
.set(&PostForm { | |
title: None, | |
body: Some("My new post"), | |
}) | |
.execute(conn) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment