Skip to content

Commit

Permalink
Update usize used in paginate to u64 (PR#789)
Browse files Browse the repository at this point in the history
  • Loading branch information
shpun817 committed Sep 7, 2022
1 parent 7fcc8fa commit 0fea81e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 31 deletions.
24 changes: 0 additions & 24 deletions examples/actix3_example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,3 @@ members = [".", "api", "core", "entity", "migration"]

[dependencies]
actix3-example-api = { path = "api" }
actix-http = "2"
actix-web = "3"
actix-flash = "0.2"
actix-files = "0.5"
futures = { version = "^0.3" }
futures-util = { version = "^0.3" }
tera = "1.8.0"
dotenv = "0.15"
listenfd = "0.3.3"
serde = "1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
entity = { path = "entity" }
migration = { path = "migration" }

[dependencies.sea-orm]
path = "../../" # remove this line in your own project
version = "^0.10.0" # sea-orm version
features = [
"debug-print",
"runtime-async-std-native-tls",
"sqlx-mysql",
# "sqlx-postgres",
# "sqlx-sqlite",
]
6 changes: 3 additions & 3 deletions examples/actix3_example/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use serde::{Deserialize, Serialize};
use std::env;
use tera::Tera;

const DEFAULT_POSTS_PER_PAGE: usize = 5;
const DEFAULT_POSTS_PER_PAGE: u64 = 5;

#[derive(Debug, Clone)]
struct AppState {
Expand All @@ -23,8 +23,8 @@ struct AppState {
}
#[derive(Debug, Deserialize)]
pub struct Params {
page: Option<usize>,
posts_per_page: Option<usize>,
page: Option<u64>,
posts_per_page: Option<u64>,
}

#[derive(Deserialize, Serialize, Debug, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion examples/actix3_example/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ entity = { path = "../entity" }

[dependencies.sea-orm]
path = "../../../" # remove this line in your own project
version = "^0.9.0" # sea-orm version
version = "^0.10.0" # sea-orm version
features = [
"debug-print",
"runtime-async-std-native-tls",
Expand Down
6 changes: 3 additions & 3 deletions examples/actix3_example/core/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ impl Query {
/// If ok, returns (post models, num pages).
pub async fn find_posts_in_page(
db: &DbConn,
page: usize,
posts_per_page: usize,
) -> Result<(Vec<post::Model>, usize), DbErr> {
page: u64,
posts_per_page: u64,
) -> Result<(Vec<post::Model>, u64), DbErr> {
// Setup paginator
let paginator = Post::find()
.order_by_asc(post::Column::Id)
Expand Down

0 comments on commit 0fea81e

Please sign in to comment.