Skip to content

Commit

Permalink
Adjust docs in sg-index-query
Browse files Browse the repository at this point in the history
  • Loading branch information
tasiov committed Jul 26, 2023
1 parent 2c25274 commit 29e4073
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions packages/sg-index-query/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ backtraces = ["cosmwasm-std/backtraces"]
library = []

[dependencies]
cosmwasm-schema = { workspace = true }
cosmwasm-std = { workspace = true }
cosmwasm-storage = { workspace = true }
cw-storage-plus = { workspace = true }
cosmwasm-schema = { workspace = true }
cosmwasm-std = { workspace = true }
cw-storage-plus = { workspace = true }

[dev-dependencies]
12 changes: 9 additions & 3 deletions packages/sg-index-query/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ pub enum QueryBound<T> {
Exclusive(T),
}

/// QueryOptions are used to paginate contract queries
/// QueryOptions are used to pass in options to a query function
#[cw_serde]
pub struct QueryOptions<T> {
/// Whether to sort items in ascending or descending order
pub descending: Option<bool>,
/// The number of items that will be returned
pub limit: Option<u32>,
/// Whether to sort items in ascending or descending order
pub descending: Option<bool>,
/// The minimum key value to fetch
pub min: Option<QueryBound<T>>,
/// The maximum key value to fetch
Expand All @@ -35,10 +35,16 @@ impl<T> Default for QueryOptions<T> {
}
}

/// QueryOptionsInternal are derived from QueryOptions
/// using the `unpack` function.
pub struct QueryOptionsInternal<'a, U: PrimaryKey<'a>> {
/// The number of items that will be returned
pub limit: usize,
/// The [cosmwasm_std::Order] used to sort items in [cw_storage_plus] range queries
pub order: Order,
/// The [cw_storage_plus::Bound] used to sort items in [cw_storage_plus] range queries
pub min: Option<Bound<'a, U>>,
/// The [cw_storage_plus::Bound] used to sort items in [cw_storage_plus] range queries
pub max: Option<Bound<'a, U>>,
}

Expand Down

0 comments on commit 29e4073

Please sign in to comment.