renamed add to 'new' to show its _real_ intentions
This commit is contained in:
parent
44b51133d2
commit
7334bb287d
@ -155,10 +155,11 @@ impl FromDB<Channel, Integer> for Channel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Channel {
|
impl Channel {
|
||||||
pub async fn add(p: &Pool, name: &str, desc: &str, kind: Integer) -> Response<Self> {
|
pub async fn new(p: &Pool, name: &str, desc: &str, kind: Integer) -> Response<Self> {
|
||||||
//! @returns on success -> Response::Row<Channel>
|
//! @returns on success -> Response::Row<Channel>
|
||||||
//! @returns on partial success -> Response::Empty
|
//! @returns on partial success -> Response::Empty
|
||||||
//! @returns on failure -> Response::Other
|
//! @returns on failure -> Response::Other
|
||||||
|
//! @returns on user failure -> Response::RestrictedInput(msg)
|
||||||
if let Ok(conn) = p.get_conn().await {
|
if let Ok(conn) = p.get_conn().await {
|
||||||
let q = "INSERT INTO channels (name, description, kind) VALUES (:n, :d, :k)";
|
let q = "INSERT INTO channels (name, description, kind) VALUES (:n, :d, :k)";
|
||||||
let insert_result = conn.drop_exec(q, params!{
|
let insert_result = conn.drop_exec(q, params!{
|
||||||
|
Loading…
Reference in New Issue
Block a user