mirror of
https://github.com/OMGeeky/google_bigquery_v2.git
synced 2025-12-27 06:29:38 +01:00
change map_err_without_data to return an Ok result on an empty Vec<T>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "google_bigquery_v2"
|
||||
version = "0.2.6"
|
||||
version = "0.2.7"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@@ -57,12 +57,17 @@ impl<T: Debug> QueryResultType<T> {
|
||||
pub fn map_err_without_data(self, message: impl Into<String>) -> Result<()> {
|
||||
match self {
|
||||
QueryResultType::WithoutRowData(result) => result,
|
||||
QueryResultType::WithRowData(data) => Err(format!(
|
||||
"map_err_without_data message:'{}' data: {:?}",
|
||||
message.into(),
|
||||
data
|
||||
)
|
||||
.into()),
|
||||
QueryResultType::WithRowData(data) => {
|
||||
if data.len() == 0 {
|
||||
return Ok(());
|
||||
}
|
||||
return Err(format!(
|
||||
"map_err_without_data message:'{}' data: {:?}",
|
||||
message.into(),
|
||||
data
|
||||
)
|
||||
.into());
|
||||
}
|
||||
}
|
||||
}
|
||||
pub fn expect_with_data(self, message: impl Into<String>) -> Vec<T> {
|
||||
|
||||
Reference in New Issue
Block a user