// Code generated by sqlc. DO NOT EDIT.
// source: query.sql

package querytest

import (
	"context"
)

const listAuthors = `-- name: ListAuthors :one
SELECT  id, username, email, name, bio
FROM    authors
WHERE   email = CASE WHEN $1::text = '' then NULL else $1::text END
        OR username = CASE WHEN $2::text = '' then NULL else $2::text END 
LIMIT   1
`

type ListAuthorsParams struct {
	Email    string
	Username string
}

func (q *Queries) ListAuthors(ctx context.Context, arg ListAuthorsParams) (Author, error) {
	row := q.db.QueryRowContext(ctx, listAuthors, arg.Email, arg.Username)
	var i Author
	err := row.Scan(
		&i.ID,
		&i.Username,
		&i.Email,
		&i.Name,
		&i.Bio,
	)
	return i, err
}
