func (q *DBQuerier) FindAuthorsScan(results pgx.BatchResults) ([]FindAuthorsRow, error) {
	rows, err := results.Query()
	if err != nil {
		return nil, fmt.Errorf("query FindAuthorsBatch: %w", err)
	}
	defer rows.Close()
	items := []FindAuthorsRow{}
	for rows.Next() {
		var item FindAuthorsRow
		if err := rows.Scan(&item.AuthorID, &item.FirstName, &item.LastName, &item.Suffix); err != nil {
			return nil, fmt.Errorf("scan FindAuthorsBatch row: %w", err)
		}
		items = append(items, item)
	}
	if err := rows.Err(); err != nil {
		return nil, fmt.Errorf("close FindAuthorsBatch rows: %w", err)
	}
	return items, err
}
FindAuthorsScan implements Querier.FindAuthorsScan.
package author
import (
	"context"
	"fmt"
	"github.com/jackc/pgconn"
	"github.com/jackc/pgtype"
	"github.com/jackc/pgx/v4"
)
type Querier interface {
	FindAuthorByID(ctx context.Context, authorID int32) (FindAuthorByIDRow, error)
	FindAuthorByIDBatch(batch genericBatch, authorID int32)
	FindAuthorByIDScan(results pgx.BatchResults) (FindAuthorByIDRow, error)
	FindAuthors(ctx context.Context, firstName string) ([]FindAuthorsRow, error)
	FindAuthorsBatch(batch genericBatch, firstName string)
	FindAuthorsScan(results pgx.BatchResults) ([]FindAuthorsRow, error)
	FindAuthorNames(ctx context.Context, authorID int32) ([]FindAuthorNamesRow, error)
	FindAuthorNamesBatch(batch genericBatch, authorID int32)
	FindAuthorNamesScan(results pgx.BatchResults) ([]FindAuthorNamesRow, error)
	DeleteAuthors(ctx context.Context) (pgconn.CommandTag, error)
	DeleteAuthorsBatch(batch genericBatch)
	DeleteAuthorsScan(results pgx.BatchResults) (pgconn.CommandTag, error)
	DeleteAuthorsByFirstName(ctx context.Context, firstName string) (pgconn.CommandTag, error)
	DeleteAuthorsByFirstNameBatch(batch genericBatch, firstName string)
	DeleteAuthorsByFirstNameScan(results pgx.BatchResults) (pgconn.CommandTag, error)
	DeleteAuthorsByFullName(ctx context.Context, params DeleteAuthorsByFullNameParams) (pgconn.CommandTag, error)
	DeleteAuthorsByFullNameBatch(batch genericBatch, params DeleteAuthorsByFullNameParams)
	DeleteAuthorsByFullNameScan(results pgx.BatchResults) (pgconn.CommandTag, error)
	InsertAuthor(ctx context.Context, firstName string, lastName string) (int32, error)
	InsertAuthorBatch(batch genericBatch, firstName string, lastName string)
	InsertAuthorScan(results pgx.BatchResults) (int32, error)
	InsertAuthorSuffix(ctx context.Context, params InsertAuthorSuffixParams) (InsertAuthorSuffixRow, error)
	InsertAuthorSuffixBatch(batch genericBatch, params InsertAuthorSuffixParams)
	InsertAuthorSuffixScan(results pgx.BatchResults) (InsertAuthorSuffixRow, error)
}
type DBQuerier struct {
	conn  genericConn    
	types *typeResolver  
}
var _ Querier = &DBQuerier{}
type genericConn interface {
	Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
	QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row
	Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)
}
type genericBatch interface {
	Queue(query string, arguments ...interface{})
}
func NewQuerier(conn genericConn) *DBQuerier {
	return NewQuerierConfig(conn, QuerierConfig{})
}
type QuerierConfig struct {
	DataTypes []pgtype.DataType
}
func NewQuerierConfig(conn genericConn, cfg QuerierConfig) *DBQuerier {
	return &DBQuerier{conn: conn, types: newTypeResolver(cfg.DataTypes)}
}
func (q *DBQuerier) WithTx(tx pgx.Tx) (*DBQuerier, error) {
	return &DBQuerier{conn: tx}, nil
}
type preparer interface {
	Prepare(ctx context.Context, name, sql string) (sd *pgconn.StatementDescription, err error)
}
func PrepareAllQueries(ctx context.Context, p preparer) error {
	if _, err := p.Prepare(ctx, findAuthorByIDSQL, findAuthorByIDSQL); err != nil {
		return fmt.Errorf("prepare query 'FindAuthorByID': %w", err)
	}
	if _, err := p.Prepare(ctx, findAuthorsSQL, findAuthorsSQL); err != nil {
		return fmt.Errorf("prepare query 'FindAuthors': %w", err)
	}
	if _, err := p.Prepare(ctx, findAuthorNamesSQL, findAuthorNamesSQL); err != nil {
		return fmt.Errorf("prepare query 'FindAuthorNames': %w", err)
	}
	if _, err := p.Prepare(ctx, deleteAuthorsSQL, deleteAuthorsSQL); err != nil {
		return fmt.Errorf("prepare query 'DeleteAuthors': %w", err)
	}
	if _, err := p.Prepare(ctx, deleteAuthorsByFirstNameSQL, deleteAuthorsByFirstNameSQL); err != nil {
		return fmt.Errorf("prepare query 'DeleteAuthorsByFirstName': %w", err)
	}
	if _, err := p.Prepare(ctx, deleteAuthorsByFullNameSQL, deleteAuthorsByFullNameSQL); err != nil {
		return fmt.Errorf("prepare query 'DeleteAuthorsByFullName': %w", err)
	}
	if _, err := p.Prepare(ctx, insertAuthorSQL, insertAuthorSQL); err != nil {
		return fmt.Errorf("prepare query 'InsertAuthor': %w", err)
	}
	if _, err := p.Prepare(ctx, insertAuthorSuffixSQL, insertAuthorSuffixSQL); err != nil {
		return fmt.Errorf("prepare query 'InsertAuthorSuffix': %w", err)
	}
	return nil
}
type typeResolver struct {
	connInfo *pgtype.ConnInfo  
}
func newTypeResolver(types []pgtype.DataType) *typeResolver {
	ci := pgtype.NewConnInfo()
	for _, typ := range types {
		if txt, ok := typ.Value.(textPreferrer); ok && typ.OID != unknownOID {
			typ.Value = txt.ValueTranscoder
		}
		ci.RegisterDataType(typ)
	}
	return &typeResolver{connInfo: ci}
}
func (tr *typeResolver) findValue(name string) (uint32, pgtype.ValueTranscoder, bool) {
	typ, ok := tr.connInfo.DataTypeForName(name)
	if !ok {
		return 0, nil, false
	}
	v := pgtype.NewValue(typ.Value)
	return typ.OID, v.(pgtype.ValueTranscoder), true
}
func (tr *typeResolver) setValue(vt pgtype.ValueTranscoder, val interface{}) pgtype.ValueTranscoder {
	if err := vt.Set(val); err != nil {
		panic(fmt.Sprintf("set ValueTranscoder %T to %+v: %s", vt, val, err))
	}
	return vt
}
const findAuthorByIDSQL = `SELECT * FROM author WHERE author_id = $1;`
type FindAuthorByIDRow struct {
	AuthorID  int32   `json:"author_id"`
	FirstName string  `json:"first_name"`
	LastName  string  `json:"last_name"`
	Suffix    *string `json:"suffix"`
}
func (q *DBQuerier) FindAuthorByID(ctx context.Context, authorID int32) (FindAuthorByIDRow, error) {
	ctx = context.WithValue(ctx, "pggen_query_name", "FindAuthorByID")
	row := q.conn.QueryRow(ctx, findAuthorByIDSQL, authorID)
	var item FindAuthorByIDRow
	if err := row.Scan(&item.AuthorID, &item.FirstName, &item.LastName, &item.Suffix); err != nil {
		return item, fmt.Errorf("query FindAuthorByID: %w", err)
	}
	return item, nil
}
func (q *DBQuerier) FindAuthorByIDBatch(batch genericBatch, authorID int32) {
	batch.Queue(findAuthorByIDSQL, authorID)
}
func (q *DBQuerier) FindAuthorByIDScan(results pgx.BatchResults) (FindAuthorByIDRow, error) {
	row := results.QueryRow()
	var item FindAuthorByIDRow
	if err := row.Scan(&item.AuthorID, &item.FirstName, &item.LastName, &item.Suffix); err != nil {
		return item, fmt.Errorf("scan FindAuthorByIDBatch row: %w", err)
	}
	return item, nil
}
const findAuthorsSQL = `SELECT * FROM author WHERE first_name = $1;`
type FindAuthorsRow struct {
	AuthorID  int32   `json:"author_id"`
	FirstName string  `json:"first_name"`
	LastName  string  `json:"last_name"`
	Suffix    *string `json:"suffix"`
}
func (q *DBQuerier) FindAuthors(ctx context.Context, firstName string) ([]FindAuthorsRow, error) {
	ctx = context.WithValue(ctx, "pggen_query_name", "FindAuthors")
	rows, err := q.conn.Query(ctx, findAuthorsSQL, firstName)
	if err != nil {
		return nil, fmt.Errorf("query FindAuthors: %w", err)
	}
	defer rows.Close()
	items := []FindAuthorsRow{}
	for rows.Next() {
		var item FindAuthorsRow
		if err := rows.Scan(&item.AuthorID, &item.FirstName, &item.LastName, &item.Suffix); err != nil {
			return nil, fmt.Errorf("scan FindAuthors row: %w", err)
		}
		items = append(items, item)
	}
	if err := rows.Err(); err != nil {
		return nil, fmt.Errorf("close FindAuthors rows: %w", err)
	}
	return items, err
}
func (q *DBQuerier) FindAuthorsBatch(batch genericBatch, firstName string) {
	batch.Queue(findAuthorsSQL, firstName)
}