Skip to content

Commit

Permalink
remove query_raw_not_empty() (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebadob authored Jan 21, 2025
1 parent 621b992 commit 3925217
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
- The `asm` feature has been removed from `sha2` to make it compile on windows.
- The shutdown delay of 10 seconds is not being applied anymore if you only run a single instance, which usually is the
case during local development. This greatly improves the DX.
- `hiqlite::Client::query_raw_not_empty()` has been removed as it was redundant. `query_raw_one()` behaves in the
same way.

## v0.4.0

Expand Down
21 changes: 0 additions & 21 deletions hiqlite/src/client/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,27 +242,6 @@ impl Client {
}
}

/// A raw query will return the bare `Row` without doing any deserialization or mapping.
///
/// This version works the same as `query_raw()` with the exception that it will return an
/// error, if no rows have been returned. This eliminates the need for manual `is_empty()` checks
/// each time.
pub async fn query_raw_not_empty<S>(
&self,
stmt: S,
params: Params,
) -> Result<Vec<crate::Row>, Error>
where
S: Into<Cow<'static, str>>,
{
let rows = self.query_raw(stmt, params).await?;
if rows.is_empty() {
Err(Error::Sqlite("No rows returned".into()))
} else {
Ok(rows)
}
}

/// A raw query will return the bare `Row` without doing any deserialization or mapping.
///
/// This version will return exactly one `Row`.
Expand Down

0 comments on commit 3925217

Please sign in to comment.