start working on async queries
This commit is contained in:
parent
f999e55fa4
commit
a707ce2f5c
5 changed files with 17 additions and 0 deletions
|
@ -22,3 +22,5 @@ typetag = "0.2"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
bb8-postgres = "0.8"
|
||||||
|
tokio = { version = "1.20", features = ["full"] }
|
||||||
|
|
11
src/asynk/async_queue.rs
Normal file
11
src/asynk/async_queue.rs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
use bb8_postgres::tokio_postgres::Client;
|
||||||
|
|
||||||
|
pub struct AsyncQueue {
|
||||||
|
pg_client: Client,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AsyncQueue {
|
||||||
|
pub fn new(pg_client: Client) -> Self {
|
||||||
|
Self { pg_client }
|
||||||
|
}
|
||||||
|
}
|
1
src/asynk/mod.rs
Normal file
1
src/asynk/mod.rs
Normal file
|
@ -0,0 +1 @@
|
||||||
|
pub mod async_queue;
|
1
src/asynk/queries/insert_task.sql
Normal file
1
src/asynk/queries/insert_task.sql
Normal file
|
@ -0,0 +1 @@
|
||||||
|
INSERT INTO "fang_tasks" ("metadata", "error_message", "state", task_type") VALUES ($1, $2, $3, $4);
|
|
@ -25,3 +25,5 @@ pub use typetag;
|
||||||
|
|
||||||
pub mod sync;
|
pub mod sync;
|
||||||
pub use sync::*;
|
pub use sync::*;
|
||||||
|
|
||||||
|
pub mod asynk;
|
||||||
|
|
Loading…
Reference in a new issue