* Removed 'unused import' warning

+ Added library crate level docs to channels module
Should hopefully make things easier
This commit is contained in:
shockrah 2020-10-21 22:39:16 -07:00
parent 35dac99d88
commit b008a0d3e1
2 changed files with 17 additions and 1 deletions

View File

@ -22,6 +22,12 @@ impl FromDB<Channel> for Channel {
type Row = Option<(UBigInt, VarChar, Option<VarChar>, Integer)>;
async fn get(p: &Pool, id: UBigInt) -> Response<Channel> {
//! Retrieves a Full single Channel row from the DB or fails in a
//! fashion described by crate::Response<Channel>
//! @param p -> SqlPool
//! @param id -> UBigInt
//! @return on_success -> Response::Row(Channel)
//! @return on_fail -> Response::{Empty, Other<String>}
if let Ok(conn) = p.get_conn().await {
let q = "SELECT id, name, description, kind FROM channels WHERE id = :id";
let result: Result<(Conn, Self::Row), SqlError> =
@ -44,6 +50,11 @@ impl FromDB<Channel> for Channel {
}
async fn update(p: &Pool, row: Self) -> Response<Channel> {
//! Updates a whole single based on a given Row Of Channel Type
//! @param p -> SqlPool
//! @param row -> Channel
//! @return on_success -> Response::Success
//! @return on_failure -> Response::Other
if let Ok(conn) = p.get_conn().await {
let q = "UPDATE channels
SET name = :name, description = :desc, kind = :kind
@ -64,6 +75,11 @@ impl FromDB<Channel> for Channel {
}
async fn delete(p: &Pool, id: UBigInt) -> Response<Channel> {
//! Deletes channel given UBigInt as the row key
//! @param p -> SqlPool
//! @param id -> UBigInt
//! @return on_success -> Response::Success
//! @return on_failure -> Response::Other
if let Ok(conn) = p.get_conn().await {
let q = "DELETE FROM channels WHERE id = :id";
let result: Result<Conn, SqlError> =

View File

@ -5,7 +5,7 @@ use mysql_async::error::Error as SqlError;
use async_trait::async_trait;
use crate::{Response, no_conn, sql_err};
use crate::{UBigInt, BigInt, Integer, VarChar};
use crate::{UBigInt, BigInt, VarChar};
use crate::common::{FromDB};