persistence_std/types/cosmos/orm/query/
v1alpha1.rs1use persistence_std_derive::CosmwasmExt;
2#[allow(clippy::derive_partial_eq_without_eq)]
4#[derive(
5 Clone,
6 PartialEq,
7 Eq,
8 ::prost::Message,
9 ::serde::Serialize,
10 ::serde::Deserialize,
11 ::schemars::JsonSchema,
12 CosmwasmExt,
13)]
14#[proto_message(type_url = "/cosmos.orm.query.v1alpha1.GetRequest")]
15#[proto_query(
16 path = "/cosmos.orm.query.v1alpha1.Query/Get",
17 response_type = GetResponse
18)]
19pub struct GetRequest {
20 #[prost(string, tag = "1")]
22 pub message_name: ::prost::alloc::string::String,
23 #[prost(string, tag = "2")]
27 pub index: ::prost::alloc::string::String,
28 #[prost(message, repeated, tag = "3")]
32 pub values: ::prost::alloc::vec::Vec<IndexValue>,
33}
34#[allow(clippy::derive_partial_eq_without_eq)]
36#[derive(
37 Clone,
38 PartialEq,
39 Eq,
40 ::prost::Message,
41 ::serde::Serialize,
42 ::serde::Deserialize,
43 ::schemars::JsonSchema,
44 CosmwasmExt,
45)]
46#[proto_message(type_url = "/cosmos.orm.query.v1alpha1.GetResponse")]
47pub struct GetResponse {
48 #[prost(message, optional, tag = "1")]
51 pub result: ::core::option::Option<crate::shim::Any>,
52}
53#[allow(clippy::derive_partial_eq_without_eq)]
55#[derive(
56 Clone,
57 PartialEq,
58 Eq,
59 ::prost::Message,
60 ::serde::Serialize,
61 ::serde::Deserialize,
62 ::schemars::JsonSchema,
63 CosmwasmExt,
64)]
65#[proto_message(type_url = "/cosmos.orm.query.v1alpha1.ListRequest")]
66#[proto_query(
67 path = "/cosmos.orm.query.v1alpha1.Query/List",
68 response_type = ListResponse
69)]
70pub struct ListRequest {
71 #[prost(string, tag = "1")]
73 pub message_name: ::prost::alloc::string::String,
74 #[prost(string, tag = "2")]
77 pub index: ::prost::alloc::string::String,
78 #[prost(message, optional, tag = "5")]
80 pub pagination: ::core::option::Option<super::super::super::base::query::v1beta1::PageRequest>,
81 #[prost(oneof = "list_request::Query", tags = "3, 4")]
85 pub query: ::core::option::Option<list_request::Query>,
86}
87pub mod list_request {
89 use persistence_std_derive::CosmwasmExt;
90 #[allow(clippy::derive_partial_eq_without_eq)]
92 #[derive(
93 Clone,
94 PartialEq,
95 Eq,
96 ::prost::Message,
97 ::serde::Serialize,
98 ::serde::Deserialize,
99 ::schemars::JsonSchema,
100 CosmwasmExt,
101 )]
102 #[proto_message(type_url = "/cosmos.orm.query.v1alpha1.ListRequest.Prefix")]
103 pub struct Prefix {
104 #[prost(message, repeated, tag = "1")]
108 pub values: ::prost::alloc::vec::Vec<super::IndexValue>,
109 }
110 #[allow(clippy::derive_partial_eq_without_eq)]
112 #[derive(
113 Clone,
114 PartialEq,
115 Eq,
116 ::prost::Message,
117 ::serde::Serialize,
118 ::serde::Deserialize,
119 ::schemars::JsonSchema,
120 CosmwasmExt,
121 )]
122 #[proto_message(type_url = "/cosmos.orm.query.v1alpha1.ListRequest.Range")]
123 pub struct Range {
124 #[prost(message, repeated, tag = "1")]
128 pub start: ::prost::alloc::vec::Vec<super::IndexValue>,
129 #[prost(message, repeated, tag = "2")]
133 pub end: ::prost::alloc::vec::Vec<super::IndexValue>,
134 }
135 #[allow(clippy::derive_partial_eq_without_eq)]
139 #[derive(
140 Clone,
141 PartialEq,
142 Eq,
143 ::prost::Oneof,
144 ::schemars::JsonSchema,
145 ::serde::Serialize,
146 ::serde::Deserialize,
147 )]
148 pub enum Query {
149 #[prost(message, tag = "3")]
151 Prefix(Prefix),
152 #[prost(message, tag = "4")]
154 Range(Range),
155 }
156}
157#[allow(clippy::derive_partial_eq_without_eq)]
159#[derive(
160 Clone,
161 PartialEq,
162 Eq,
163 ::prost::Message,
164 ::serde::Serialize,
165 ::serde::Deserialize,
166 ::schemars::JsonSchema,
167 CosmwasmExt,
168)]
169#[proto_message(type_url = "/cosmos.orm.query.v1alpha1.ListResponse")]
170pub struct ListResponse {
171 #[prost(message, repeated, tag = "1")]
173 pub results: ::prost::alloc::vec::Vec<crate::shim::Any>,
174 #[prost(message, optional, tag = "5")]
176 pub pagination: ::core::option::Option<super::super::super::base::query::v1beta1::PageResponse>,
177}
178#[allow(clippy::derive_partial_eq_without_eq)]
180#[derive(
181 Clone,
182 PartialEq,
183 Eq,
184 ::prost::Message,
185 ::serde::Serialize,
186 ::serde::Deserialize,
187 ::schemars::JsonSchema,
188 CosmwasmExt,
189)]
190#[proto_message(type_url = "/cosmos.orm.query.v1alpha1.IndexValue")]
191pub struct IndexValue {
192 #[prost(oneof = "index_value::Value", tags = "1, 2, 3, 4, 5, 6, 7, 8")]
194 pub value: ::core::option::Option<index_value::Value>,
195}
196pub mod index_value {
198 use persistence_std_derive::CosmwasmExt;
199 #[allow(clippy::derive_partial_eq_without_eq)]
201 #[derive(
202 Clone,
203 PartialEq,
204 Eq,
205 ::prost::Oneof,
206 ::schemars::JsonSchema,
207 ::serde::Serialize,
208 ::serde::Deserialize,
209 )]
210 pub enum Value {
211 #[prost(uint64, tag = "1")]
214 Uint(u64),
215 #[prost(int64, tag = "2")]
218 Int(i64),
219 #[prost(string, tag = "3")]
221 Str(::prost::alloc::string::String),
222 #[prost(bytes, tag = "4")]
224 Bytes(::prost::alloc::vec::Vec<u8>),
225 #[prost(string, tag = "5")]
227 Enum(::prost::alloc::string::String),
228 #[prost(bool, tag = "6")]
230 Bool(bool),
231 #[prost(message, tag = "7")]
233 Timestamp(crate::shim::Timestamp),
234 #[prost(message, tag = "8")]
236 Duration(crate::shim::Duration),
237 }
238}
239pub struct V1alpha1Querier<'a, Q: cosmwasm_std::CustomQuery> {
240 querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>,
241}
242impl<'a, Q: cosmwasm_std::CustomQuery> V1alpha1Querier<'a, Q> {
243 pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self {
244 Self { querier }
245 }
246 pub fn get(
247 &self,
248 message_name: ::prost::alloc::string::String,
249 index: ::prost::alloc::string::String,
250 values: ::prost::alloc::vec::Vec<IndexValue>,
251 ) -> Result<GetResponse, cosmwasm_std::StdError> {
252 GetRequest {
253 message_name,
254 index,
255 values,
256 }
257 .query(self.querier)
258 }
259 pub fn list(
260 &self,
261 message_name: ::prost::alloc::string::String,
262 index: ::prost::alloc::string::String,
263 pagination: ::core::option::Option<super::super::super::base::query::v1beta1::PageRequest>,
264 query: ::core::option::Option<list_request::Query>,
265 ) -> Result<ListResponse, cosmwasm_std::StdError> {
266 ListRequest {
267 message_name,
268 index,
269 pagination,
270 query,
271 }
272 .query(self.querier)
273 }
274}