---
source: tests/codegen.rs
expression: code
---
// Code generated by sqlc-gen-sqlx v[VERSION]. DO NOT EDIT.
// sqlc version: [VERSION]
#![allow(dead_code, reason = "generated queries may expose items a caller does not use")]
const LIST_AUTHORS_BY_IDS: &str = "SELECT id, name, bio FROM authors WHERE id = ANY($1)";
#[derive(Debug, Clone, sqlx::FromRow)]
pub struct ListAuthorsByIdsRow {
pub id: i64,
pub name: String,
pub bio: Option<String>,
}
pub struct Queries<E> {
db: E,
}
impl<E> Queries<E> {
pub fn new(db: E) -> Self {
Self { db }
}
}
impl<E> Queries<E>
where
for<'c> &'c mut E: sqlx::Executor<'c, Database = sqlx::Postgres>,
{
pub async fn list_authors_by_ids(
&mut self,
id: Vec<i64>,
) -> Result<Vec<ListAuthorsByIdsRow>, sqlx::Error> {
sqlx::query_as::<_, ListAuthorsByIdsRow>(LIST_AUTHORS_BY_IDS)
.bind(id)
.fetch_all(&mut self.db)
.await
}
}