some more docs
This commit is contained in:
parent
1314320260
commit
41206abac1
29 changed files with 119 additions and 0 deletions
|
@ -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)?,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue