Last active
March 1, 2020 11:24
-
-
Save dunnock/265a68a728f211b532a84084df4284b2 to your computer and use it in GitHub Desktop.
actix-node-benchmark: Rust get-tasks via deadpool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub async fn get_tasks(pool: Arc<Pool>, query: GetTasksQuery) -> Result<Vec<Task>, BenchError> { | |
let _stmt = query.get_statement(); | |
let client = pool.get().await?; | |
let stmt = client.prepare_typed(&_stmt, &[Type::VARCHAR, Type::VARCHAR, Type::OID]).await?; | |
client.query( | |
&stmt, | |
&[ &like(query.assignee_name), &like(query.summary), &query.limit.or(Some(10)) ], | |
).await? | |
.iter() | |
.map(|row| Task::from_row_ref(row).map_err(BenchError::from)) | |
.collect() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment