some more docs

This commit is contained in:
Sebastian Hugentobler 2025-07-02 21:57:44 +02:00
parent 1314320260
commit 41206abac1
Signed by: shu
SSH key fingerprint: SHA256:ppcx6MlixdNZd5EUM1nkHOKoyQYoJwzuQKXM6J/t66M
29 changed files with 119 additions and 0 deletions

View file

@ -39,25 +39,34 @@ pub struct AuthorBooksError {
}
#[derive(Debug, Snafu)]
/// Errors that can occur when fetching a series' books.
pub enum SeriesBookError {
/// A failure to prepare the SQL statement.
#[snafu(display("Failed to prepare statement."))]
PrepareSeriesBook { source: rusqlite::Error },
/// A failure to execute the SQL statement.
#[snafu(display("Failed to execute statement."))]
ExecuteSeriesBook { source: rusqlite::Error },
}
#[derive(Debug, Snafu)]
/// Errors that can occur when fetching recent books.
pub enum RecentBooksError {
/// A failure to prepare the SQL statement.
#[snafu(display("Failed to prepare statement."))]
PrepareRecentBooks { source: rusqlite::Error },
/// A failure to execute the SQL statement.
#[snafu(display("Failed to execute statement."))]
ExecuteRecentBooks { source: rusqlite::Error },
}
#[derive(Debug, Snafu)]
/// Errors that can occur when fetching a single book.
pub enum ScalarBookError {
/// A failure to prepare the SQL statement.
#[snafu(display("Failed to prepare statement."))]
PrepareScalarBook { source: rusqlite::Error },
/// A failure to execute the SQL statement.
#[snafu(display("Failed to execute statement."))]
ExecuteScalarBook { source: rusqlite::Error },
}
@ -75,6 +84,7 @@ pub struct MoreBooksError {
}
impl Book {
/// Create a book from a database row.
fn from_row(row: &Row<'_>) -> Result<Self, rusqlite::Error> {
Ok(Self {
id: row.get(0)?,