Skip to content

Instantly share code, notes, and snippets.

@dunnock
Created March 1, 2020 11:19
Show Gist options
  • Save dunnock/0ed44ab39bd4eca07c8df8856b07ba5a to your computer and use it in GitHub Desktop.
Save dunnock/0ed44ab39bd4eca07c8df8856b07ba5a to your computer and use it in GitHub Desktop.
actix-node-benchmark: JavaScript get-tasks via knex
async function get_tasks(assignee_name, summary, limit, full) {
let query = full ? query_get_tasks_full() : query_get_tasks();
if (!!assignee_name) {
query.where("assignee.name", "LIKE", `%${assignee_name}%`)
}
if (!!summary) {
query.where("summary", "LIKE", `%${summary}%`)
}
query.limit(limit || 10);
let rows = await query;
return rows.map(row => task.fromRow(row));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment