Skip to content

Commit

Permalink
ci test (do not merge)
Browse files Browse the repository at this point in the history
  • Loading branch information
1Dragoon committed Mar 14, 2024
1 parent bc2b4ab commit 012ae9c
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 42 deletions.
54 changes: 27 additions & 27 deletions diesel/src/pg/expression/extensions/interval_dsl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,31 +313,31 @@ mod tests {
test_fn!(i64, test_years, years, (i32::MAX / 12) as i64);
}

#[test]
fn intervals_match_pg_values_f64() {
const MAX_DIFF: i64 = 1_000_000;
// postgres does not really support intervals with more than i32::MAX microseconds
// https://www.postgresql.org/message-id/[email protected]
test_fn!(
f64,
test_microseconds,
microseconds,
i32::MAX as f64,
MAX_DIFF
);
test_fn!(
f64,
test_milliseconds,
milliseconds,
i32::MAX as f64,
MAX_DIFF
);
test_fn!(f64, test_seconds, seconds, i32::MAX as f64, MAX_DIFF);
test_fn!(f64, test_minutes, minutes, i32::MAX as f64, MAX_DIFF);
test_fn!(f64, test_hours, hours, i32::MAX as f64, MAX_DIFF);
test_fn!(f64, test_days, days, i32::MAX as f64, MAX_DIFF);
test_fn!(f64, test_weeks, weeks, (i32::MAX / 7) as f64, MAX_DIFF);
test_fn!(f64, test_months, months, i32::MAX as f64, MAX_DIFF);
test_fn!(f64, test_years, years, (i32::MAX / 12) as f64, MAX_DIFF);
}
// #[test]
// fn intervals_match_pg_values_f64() {
// const MAX_DIFF: i64 = 1_000_000;
// // postgres does not really support intervals with more than i32::MAX microseconds
// // https://www.postgresql.org/message-id/[email protected]
// test_fn!(
// f64,
// test_microseconds,
// microseconds,
// i32::MAX as f64,
// MAX_DIFF
// );
// test_fn!(
// f64,
// test_milliseconds,
// milliseconds,
// i32::MAX as f64,
// MAX_DIFF
// );
// test_fn!(f64, test_seconds, seconds, i32::MAX as f64, MAX_DIFF);
// test_fn!(f64, test_minutes, minutes, i32::MAX as f64, MAX_DIFF);
// test_fn!(f64, test_hours, hours, i32::MAX as f64, MAX_DIFF);
// test_fn!(f64, test_days, days, i32::MAX as f64, MAX_DIFF);
// test_fn!(f64, test_weeks, weeks, (i32::MAX / 7) as f64, MAX_DIFF);
// test_fn!(f64, test_months, months, i32::MAX as f64, MAX_DIFF);
// test_fn!(f64, test_years, years, (i32::MAX / 12) as f64, MAX_DIFF);
// }
}
10 changes: 8 additions & 2 deletions diesel/src/pg/types/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,15 @@ impl ToSql<sql_types::Jsonb, Pg> for serde_json::Value {
}
}

#[cfg(tests)]
#[cfg(test)]
mod tests {
use crate::query_builder::bind_types::ByteWrapper;
use crate::{
deserialize::FromSql,
pg::{Pg, PgValue},
query_builder::bind_collector::ByteWrapper,
serialize::{Output, ToSql},
sql_types,
};

#[test]
fn json_to_sql() {
Expand Down
2 changes: 1 addition & 1 deletion examples/postgres/advanced-blog-cli/src/pagination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl<T> Paginated<T> {
{
let per_page = self.per_page;
let results = self.load::<(U, i64)>(conn)?;
let total = results.get(0).map(|x| x.1).unwrap_or(0);
let total = results.first().map(|x| x.1).unwrap_or(0);
let records = results.into_iter().map(|x| x.0).collect();
let total_pages = (total as f64 / per_page as f64).ceil() as i64;
Ok((records, total_pages))
Expand Down
6 changes: 1 addition & 5 deletions examples/postgres/advanced-blog-cli/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,4 @@ diesel::joinable!(comments -> posts (post_id));
diesel::joinable!(comments -> users (user_id));
diesel::joinable!(posts -> users (user_id));

diesel::allow_tables_to_appear_in_same_query!(
comments,
posts,
users,
);
diesel::allow_tables_to_appear_in_same_query!(comments, posts, users,);
7 changes: 1 addition & 6 deletions examples/postgres/relations/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,4 @@ diesel::joinable!(books_authors -> authors (author_id));
diesel::joinable!(books_authors -> books (book_id));
diesel::joinable!(pages -> books (book_id));

diesel::allow_tables_to_appear_in_same_query!(
authors,
books,
books_authors,
pages,
);
diesel::allow_tables_to_appear_in_same_query!(authors, books, books_authors, pages,);
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.74.0
1.65.0

0 comments on commit 012ae9c

Please sign in to comment.