Replies: 2 comments 1 reply
-
Thanks for writing this bug report. Please complete the issue template. Its mandatory for issues in our tracker.. If you don't feel that your report fits into the template consider moving it to discussion forum. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I've now converted this issue into a discussion as it does not seem to be a bugreport at all, but rather a support question.
Otherwise it's just not possible to help you in any way. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
hello, i have defined a new trait by diesel_async:
`use std::marker::PhantomData;
use diesel::mysql::Mysql;
use diesel::pg::Pg;
use diesel::query_dsl::LoadQuery;
use diesel::sql_types::BigInt;
use diesel::{query_builder::*, QueryResult};
use diesel_async::RunQueryDsl;
use diesel_async::AsyncConnection;
pub trait Paginate: Sized {
fn paginate(self, offset: usize, limit: usize) -> PaginatedQuery<Self, DB> {
PaginatedQuery {
query: self,
offset: offset as i64,
limit: limit as i64,
_marker: PhantomData,
}
}
}
impl<T, DB> Paginate for T {}
#[derive(Debug)]
pub struct PaginatedQuery<T, Conn> {
query: T,
offset: i64,
limit: i64,
_marker: PhantomData,
}
impl<T, Conn> PaginatedQuery<T, Conn> {
pub fn load_and_total<'a, U>(self, conn: &mut Conn) -> QueryResult<(Vec, i64)>
where
Self: LoadQuery<'a, Conn, (U, i64)>,
{
let results = self.load::<(U, i64)>(conn)?;
let total = *results.get(0).map(|(, total)| total).unwrap_or(&0);
let records: Vec = results.into_iter().map(|(record, )| record).collect();
Ok((records, total))
}
}
but the follow code reports an error.
impl<T, Conn> RunQueryDsl for PaginatedQuery<T, Conn> {}`the error is "conflicting implementations of traitdiesel_async::RunQueryDsl<>for typepaginate_async::PaginatedQuery<, _>conflicting implementation in cratediesel_async:
impl<T, Conn> diesel_async::RunQueryDsl for T;"
what should i do for this error? thank you.
Beta Was this translation helpful? Give feedback.
All reactions