1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
//go:build sqlite
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.25.0
// source: sexps.sql
package model
import (
"context"
"database/sql"
)
const getSingleExpenses = `-- name: GetSingleExpenses :many
SELECT id, description
FROM single_expenses
WHERE user_id = ?
`
type GetSingleExpensesRow struct {
ID int64
Description sql.NullString
}
// GetSingleExpenses
//
// SELECT id, description
// FROM single_expenses
// WHERE user_id = ?
func (q *Queries) GetSingleExpenses(ctx context.Context, userID int64) ([]GetSingleExpensesRow, error) {
rows, err := q.db.QueryContext(ctx, getSingleExpenses, userID)
if err != nil {
return nil, err
}
defer rows.Close()
var items []GetSingleExpensesRow
for rows.Next() {
var i GetSingleExpensesRow
if err := rows.Scan(&i.ID, &i.Description); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Close(); err != nil {
return nil, err
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
|