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

package querytest

import (
	"context"

	"github.com/jackc/pgx/v5/pgtype"
)

const selectJoinUsing = `-- name: SelectJoinUsing :many
select t1.fk, sum(t2.fk) from t1 join t2 using (fk) group by fk
`

type SelectJoinUsingRow struct {
	Fk  int32
	Sum pgtype.Int8
}

func (q *Queries) SelectJoinUsing(ctx context.Context) ([]SelectJoinUsingRow, error) {
	rows, err := q.db.Query(ctx, selectJoinUsing)
	if err != nil {
		return nil, err
	}
	defer rows.Close()
	var items []SelectJoinUsingRow
	for rows.Next() {
		var i SelectJoinUsingRow
		if err := rows.Scan(&i.Fk, &i.Sum); err != nil {
			return nil, err
		}
		items = append(items, i)
	}
	if err := rows.Err(); err != nil {
		return nil, err
	}
	return items, nil
}
