Skip to content
This repository was archived by the owner on Apr 9, 2024. It is now read-only.

refactor(rpc): unify the values ​​in all types in rpc as hex string type #405

Merged
merged 8 commits into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl Range {
}

pub fn is_in(&self, num: u64) -> bool {
self.from <= num && num <= self.to
num >= self.from && num <= self.to
}

pub fn min(&self) -> u64 {
Expand All @@ -181,7 +181,7 @@ impl Range {

#[derive(Serialize, Deserialize, Default, Clone, Debug, Hash, PartialEq, Eq)]
pub struct PaginationRequest {
pub cursor: Option<Bytes>,
pub cursor: Option<u64>,
pub order: Order,
pub limit: Option<u64>,
pub skip: Option<u64>,
Expand All @@ -190,7 +190,7 @@ pub struct PaginationRequest {

impl PaginationRequest {
pub fn new(
cursor: Option<Bytes>,
cursor: Option<u64>,
order: Order,
limit: Option<u64>,
skip: Option<u64>,
Expand Down Expand Up @@ -223,15 +223,15 @@ impl PaginationRequest {
self.limit = limit;
}

pub fn update_by_response(&mut self, next_cursor: Option<Bytes>) {
pub fn update_by_response(&mut self, next_cursor: Option<u64>) {
self.cursor = next_cursor;
}
}

#[derive(Serialize, Deserialize, Clone, Debug, Hash, PartialEq, Eq)]
pub struct PaginationResponse<T> {
pub response: Vec<T>,
pub next_cursor: Option<Bytes>,
pub next_cursor: Option<u64>,
pub count: Option<u64>,
}

Expand Down
Loading