MCPcopy Create free account
hub / github.com/actix/examples / create_task

Function create_task

basics/todo/src/db.rs:16–22  ·  view source on GitHub ↗
(todo: String, pool: &SqlitePool)

Source from the content-addressed store, hash-verified

14}
15
16pub async fn create_task(todo: String, pool: &SqlitePool) -> Result<(), &'static str> {
17 let new_task = NewTask { description: todo };
18 Task::insert(new_task, pool)
19 .await
20 .map(|_| ())
21 .map_err(|_| "Error inserting task")
22}
23
24pub async fn toggle_task(id: i32, pool: &SqlitePool) -> Result<(), &'static str> {
25 Task::toggle_with_id(id, pool)

Callers 1

createFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected