diff options
Diffstat (limited to 'model/sexps.sql.go')
-rw-r--r-- | model/sexps.sql.go | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/model/sexps.sql.go b/model/sexps.sql.go index 1108e55..8a54443 100644 --- a/model/sexps.sql.go +++ b/model/sexps.sql.go @@ -7,27 +7,28 @@ package model import ( "context" - "database/sql" + + "github.com/jackc/pgx/v5/pgtype" ) const getSingleExpenses = `-- name: GetSingleExpenses :many SELECT id, description FROM single_expenses - WHERE user_id = ? + WHERE user_id = $1 ` type GetSingleExpensesRow struct { - ID int32 - Description sql.NullString + ID int64 + Description pgtype.Text } // GetSingleExpenses // // SELECT id, description // FROM single_expenses -// WHERE user_id = ? +// WHERE user_id = $1 func (q *Queries) GetSingleExpenses(ctx context.Context, userID int32) ([]GetSingleExpensesRow, error) { - rows, err := q.db.QueryContext(ctx, getSingleExpenses, userID) + rows, err := q.db.Query(ctx, getSingleExpenses, userID) if err != nil { return nil, err } @@ -40,9 +41,6 @@ func (q *Queries) GetSingleExpenses(ctx context.Context, userID int32) ([]GetSin } items = append(items, i) } - if err := rows.Close(); err != nil { - return nil, err - } if err := rows.Err(); err != nil { return nil, err } |