1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
use pin;
use *;
use try_stream;
use ;
pub use Stream;
pub use StreamExt;
/// Executes a DynamoDB `Scan` request, collecting all pages into a `Vec`.
///
/// Automatically follows `LastEvaluatedKey` pagination tokens until all items
/// have been retrieved. This is the low-level function used by
/// [`ScanRequest::all`][crate::ScanRequest::all]. Prefer using
/// [`DynamoDBItemOp::scan`] or [`ScanRequest`] directly
/// unless you are working with a raw [`ScanFluentBuilder`].
///
/// # Errors
///
/// Returns [`Err`] if any DynamoDB page request fails.
///
/// # Examples
///
/// ```no_run
/// # use dynamodb_facade::test_fixtures::*;
/// use dynamodb_facade::dynamodb_execute_scan;
///
/// # async fn example(client: aws_sdk_dynamodb::Client) -> dynamodb_facade::Result<()> {
/// let builder = client.scan().table_name("platform");
/// let items = dynamodb_execute_scan::<PlatformTable>(builder).await?;
/// # Ok(())
/// # }
/// ```
pub async
/// Creates a lazy async [`Stream`] of scan results with automatic pagination.
///
/// Each element yielded by the stream is a `Vec<Item<TD>>` representing one
/// page of results. Pages are fetched on demand as the stream is consumed.
/// Each page's `LastEvaluatedKey` is used as the `ExclusiveStartKey` for the
/// next request. This is the low-level function used by
/// [`ScanRequest::stream`][crate::ScanRequest::stream]. Prefer using
/// [`DynamoDBItemOp::scan`] or [`ScanRequest`] directly
/// unless you are working with a raw [`ScanFluentBuilder`].
///
/// # Examples
///
/// ```no_run
/// # use dynamodb_facade::test_fixtures::*;
/// use dynamodb_facade::dynamodb_stream_scan;
/// use futures_util::StreamExt;
/// use std::pin::pin;
///
/// # async fn example(client: aws_sdk_dynamodb::Client) -> dynamodb_facade::Result<()> {
/// let builder = client.scan().table_name("platform");
/// let stream = dynamodb_stream_scan::<PlatformTable>(builder);
/// // Must pin the stream
/// let mut stream = pin!(stream);
///
/// while let Some(result) = stream.next().await {
/// let page /* : Vec<Item<PlatformTable>> */ = result?;
/// for item in page {
/// let _ = item;
/// }
/// }
/// # Ok(())
/// # }
/// ```
/// Executes a DynamoDB `Query` request, collecting all pages into a `Vec`.
///
/// Automatically follows `LastEvaluatedKey` pagination tokens until all
/// matching items have been retrieved. This is the low-level function used by
/// [`QueryRequest::all`][crate::QueryRequest::all]. Prefer using
/// [`DynamoDBItemOp::query`] or [`QueryRequest`] directly
/// unless you are working with a raw [`QueryFluentBuilder`].
///
/// # Errors
///
/// Returns [`Err`] if any DynamoDB page request fails.
///
/// # Examples
///
/// ```no_run
/// # use dynamodb_facade::test_fixtures::*;
/// use dynamodb_facade::dynamodb_execute_query;
///
/// # async fn example(client: aws_sdk_dynamodb::Client) -> dynamodb_facade::Result<()> {
/// let builder = client
/// .query()
/// .table_name("platform")
/// .key_condition_expression("PK = :pk")
/// .expression_attribute_values(
/// ":pk",
/// aws_sdk_dynamodb::types::AttributeValue::S("USER#user-1".into()),
/// );
/// let items = dynamodb_execute_query::<PlatformTable>(builder).await?;
/// # Ok(())
/// # }
/// ```
pub async
/// Creates a lazy async [`Stream`] of query results with automatic pagination.
///
/// Each element yielded by the stream is a `Vec<Item<TD>>` representing one
/// page of results. Pages are fetched on demand as the stream is consumed.
/// Each page's `LastEvaluatedKey` is used as the `ExclusiveStartKey` for the
/// next request. This is the low-level function used by
/// [`QueryRequest::stream`][crate::QueryRequest::stream]. Prefer using
/// [`DynamoDBItemOp::query`] or [`QueryRequest`] directly
/// unless you are working with a raw [`QueryFluentBuilder`].
///
/// # Examples
///
/// ```no_run
/// # use dynamodb_facade::test_fixtures::*;
/// use dynamodb_facade::dynamodb_stream_query;
/// use futures_util::StreamExt;
/// use std::pin::pin;
///
/// # async fn example(client: aws_sdk_dynamodb::Client) -> dynamodb_facade::Result<()> {
/// let builder = client
/// .query()
/// .table_name("platform")
/// .key_condition_expression("PK = :pk")
/// .expression_attribute_values(
/// ":pk",
/// aws_sdk_dynamodb::types::AttributeValue::S("USER#user-1".into()),
/// );
/// let stream = dynamodb_stream_query::<PlatformTable>(builder);
/// // Must pin the stream
/// let mut stream = pin!(stream);
///
/// while let Some(result) = stream.next().await {
/// let page /* : Vec<Item<PlatformTable>> */ = result?;
/// for item in page {
/// let _ = item;
/// }
/// }
/// # Ok(())
/// # }
/// ```