List tables with pagination.
(
&self,
database: &str,
max_results: Option<u32>,
page_token: Option<&str>,
table_name_pattern: Option<&str>,
table_type: Option<&str>,
)
| 293 | |
| 294 | /// List tables with pagination. |
| 295 | pub async fn list_tables_paged( |
| 296 | &self, |
| 297 | database: &str, |
| 298 | max_results: Option<u32>, |
| 299 | page_token: Option<&str>, |
| 300 | table_name_pattern: Option<&str>, |
| 301 | table_type: Option<&str>, |
| 302 | ) -> Result<PagedList<String>> { |
| 303 | validate_non_empty(database, "database name")?; |
| 304 | let path = self.resource_paths.tables(Some(database)); |
| 305 | let mut params: Vec<(&str, String)> = Vec::new(); |
| 306 | |
| 307 | if let Some(max) = max_results { |
| 308 | params.push((Self::MAX_RESULTS, max.to_string())); |
| 309 | } |
| 310 | |
| 311 | if let Some(token) = page_token { |
| 312 | params.push((Self::PAGE_TOKEN, token.to_string())); |
| 313 | } |
| 314 | |
| 315 | if let Some(pattern) = table_name_pattern { |
| 316 | params.push((Self::TABLE_NAME_PATTERN, pattern.to_string())); |
| 317 | } |
| 318 | |
| 319 | if let Some(ttype) = table_type { |
| 320 | params.push((Self::TABLE_TYPE, ttype.to_string())); |
| 321 | } |
| 322 | |
| 323 | let response: ListTablesResponse = if params.is_empty() { |
| 324 | self.client.get(&path, None::<&[(&str, &str)]>).await? |
| 325 | } else { |
| 326 | self.client.get(&path, Some(¶ms)).await? |
| 327 | }; |
| 328 | |
| 329 | Ok(PagedList::new( |
| 330 | response.tables.unwrap_or_default(), |
| 331 | response.next_page_token, |
| 332 | )) |
| 333 | } |
| 334 | |
| 335 | /// Create a new table. |
| 336 | pub async fn create_table(&self, identifier: &Identifier, schema: Schema) -> Result<()> { |
no test coverage detected