* Removed 'unused import' warning
+ Added library crate level docs to channels module Should hopefully make things easier
This commit is contained in:
parent
35dac99d88
commit
b008a0d3e1
@ -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> =
|
||||
|
@ -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};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user