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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
diff --git a/database/transactions.sql.go b/database/transactions.sql.go
index 3db2b494275d52bc29f333ac66ab726c11b2d175..f1aeea36704370894710e2216dcdf246b32b1442 100644
--- a/database/transactions.sql.go
+++ b/database/transactions.sql.go
@@ -12,11 +12,11 @@ )
const createTransaction = `-- name: CreateTransaction :one
INSERT INTO transactions (
- title, amount, date, recurrance
+ title, amount, date, recurrance, week, is_income
) VALUES (
- ?, ?, ?, ?
+ ?, ?, ?, ?, ?, ?
)
-RETURNING id, title, amount, date, recurrance
+RETURNING id, title, amount, date, recurrance, week, is_income
`
type CreateTransactionParams struct {
@@ -24,6 +24,8 @@ Title string
Amount int64
Date time.Time
Recurrance string
+ Week int64
+ IsIncome bool
}
func (q *Queries) CreateTransaction(ctx context.Context, arg CreateTransactionParams) (Transaction, error) {
@@ -32,6 +34,8 @@ arg.Title,
arg.Amount,
arg.Date,
arg.Recurrance,
+ arg.Week,
+ arg.IsIncome,
)
var i Transaction
err := row.Scan(
@@ -40,6 +44,8 @@ &i.Title,
&i.Amount,
&i.Date,
&i.Recurrance,
+ &i.Week,
+ &i.IsIncome,
)
return i, err
}
@@ -55,7 +61,7 @@ return err
}
const getTransaction = `-- name: GetTransaction :one
-SELECT id, title, amount, date, recurrance from transactions
+SELECT id, title, amount, date, recurrance, week, is_income from transactions
WHERE id = ? LIMIT 1
`
@@ -68,22 +74,24 @@ &i.Title,
&i.Amount,
&i.Date,
&i.Recurrance,
+ &i.Week,
+ &i.IsIncome,
)
return i, err
}
const listTransactions = `-- name: ListTransactions :many
-SELECT id, title, amount, date, recurrance FROM transactions
-WHERE date > ? AND date < ?
+SELECT id, title, amount, date, recurrance, week, is_income FROM transactions
+WHERE date BETWEEN ? AND ?
`
type ListTransactionsParams struct {
- Date time.Time
- Date_2 time.Time
+ FromDate time.Time
+ ToDate time.Time
}
func (q *Queries) ListTransactions(ctx context.Context, arg ListTransactionsParams) ([]Transaction, error) {
- rows, err := q.db.QueryContext(ctx, listTransactions, arg.Date, arg.Date_2)
+ rows, err := q.db.QueryContext(ctx, listTransactions, arg.FromDate, arg.ToDate)
if err != nil {
return nil, err
}
@@ -97,6 +105,8 @@ &i.Title,
&i.Amount,
&i.Date,
&i.Recurrance,
+ &i.Week,
+ &i.IsIncome,
); err != nil {
return nil, err
}
@@ -113,9 +123,9 @@ }
const updateTransaction = `-- name: UpdateTransaction :one
UPDATE transactions
-SET title = ?, amount = ?, date = ?, recurrance = ?
+SET title = ?, amount = ?, date = ?, recurrance = ?, week = ?, is_income = ?
WHERE id = ?
-RETURNING id, title, amount, date, recurrance
+RETURNING id, title, amount, date, recurrance, week, is_income
`
type UpdateTransactionParams struct {
@@ -123,6 +133,8 @@ Title string
Amount int64
Date time.Time
Recurrance string
+ Week int64
+ IsIncome bool
ID int64
}
@@ -132,6 +144,8 @@ arg.Title,
arg.Amount,
arg.Date,
arg.Recurrance,
+ arg.Week,
+ arg.IsIncome,
arg.ID,
)
var i Transaction
@@ -141,6 +155,8 @@ &i.Title,
&i.Amount,
&i.Date,
&i.Recurrance,
+ &i.Week,
+ &i.IsIncome,
)
return i, err
}
|