Skip to content
Discussion options

You must be logged in to vote

Gotcha

//use diesel::backend::{BindCollector, QueryBuilder};
//use diesel::impl_query_id; // deprecated since 1.1.0
use diesel::pg::Pg;
use diesel::query_builder::{AsQuery, AstPass, Query, QueryFragment};
use diesel::query_dsl::LoadQuery;
use diesel::sql_types::BigInt;
use diesel::{PgConnection, QueryResult, RunQueryDsl};
use diesel::{QueryId, Queryable};
use diesel_demo::establish_connection;
use diesel_demo::models::Post;
use diesel_demo::schema::posts;

// Implement `QueryFragment`
impl<T> QueryFragment<Pg> for PaginatedQuery<T>
where
    T: QueryFragment<Pg>,
{
    fn walk_ast(&self, mut out: AstPass<Pg>) -> QueryResult<()> {
        out.push_sql("SELECT *, COUNT(*) OVER () FROM (");

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@tyoc213
Comment options

@tyoc213
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by tyoc213
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants