---
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_OPTIONAL_BIO: &str = "SELECT id, name, bio FROM authors WHERE bio = $1";
#[derive(Debug, Clone, sqlx::FromRow)]
pub struct ListAuthorsByOptionalBioRow {
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_optional_bio(
&mut self,
bio: Option<String>,
) -> Result<Vec<ListAuthorsByOptionalBioRow>, sqlx::Error> {
sqlx::query_as::<_, ListAuthorsByOptionalBioRow>(LIST_AUTHORS_BY_OPTIONAL_BIO)
.bind(bio)
.fetch_all(&mut self.db)
.await
}
}