From 4a9f8ec2e8baa94c27edd0c323c6f0a0d7b14a6c Mon Sep 17 00:00:00 2001 From: MedzikUser Date: Sun, 18 Sep 2022 15:14:25 +0200 Subject: [PATCH] chore: cosmetic changes --- README.md | 4 +++- src/database/error.rs | 14 ++++++-------- src/database/mod.rs | 2 +- src/database/sqlite.rs | 1 - src/database/user.rs | 2 +- src/main.rs | 4 +--- 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 0f2cdb9..9783d19 100644 --- a/README.md +++ b/README.md @@ -9,5 +9,7 @@     - + +   +

diff --git a/src/database/error.rs b/src/database/error.rs index cc99587..9b61894 100644 --- a/src/database/error.rs +++ b/src/database/error.rs @@ -1,21 +1,19 @@ use thiserror::Error; -/// Database Error #[derive(Debug, Error)] pub enum Error { - #[error("user not found")] + #[error("User not found")] UserNotFound, - #[error("failed to open database: {0}")] + #[error("Failed to open database: {0}")] OpenDatabase(sqlx::Error), - #[error("failed to connect to the database: {0}")] + #[error("Failed to open connection with database: {0}")] ConnectDatabase(sqlx::Error), - #[error("failed to get row: {0}")] + #[error("Failed to get row: {0}")] GetRow(sqlx::Error), - #[error("failed to create all required tables: {0}")] + #[error("Failed to create all required tables: {0}")] CreateTables(sqlx::Error), - #[error("failed to execute the query: {0}")] + #[error("Failed to execute the query: {0}")] Execute(sqlx::Error), } -/// Custom Result alias for a [enum@Error]. pub type Result = std::result::Result; diff --git a/src/database/mod.rs b/src/database/mod.rs index 4eca388..34db56d 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -1,4 +1,4 @@ -//! [SQLite database functions](sqlite::Database). +//! [SQLite database functions](sqlite::Database) pub mod error; mod sqlite; diff --git a/src/database/sqlite.rs b/src/database/sqlite.rs index f51f977..d0a0a24 100644 --- a/src/database/sqlite.rs +++ b/src/database/sqlite.rs @@ -19,7 +19,6 @@ pub struct Database { pub pool: SqlitePool, } -// TODO: Check UUID impl Database { /// Open a SQLite database pub async fn open(path: &str) -> Result { diff --git a/src/database/user.rs b/src/database/user.rs index ad514fc..acc3a46 100644 --- a/src/database/user.rs +++ b/src/database/user.rs @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize}; use uuid::Uuid; /// SQL user entry -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)] pub struct User { pub id: String, pub username: String, diff --git a/src/main.rs b/src/main.rs index ba65535..7332b60 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,6 @@ //! HomeDisk cloud server //! -//! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github -//! -//! [![github]](https://github.com/MedzikUser/HomeDisk) +//! [Source code available on GitHub](https://github.com/MedzikUser/HomeDisk) //! //! ## Configure //!