-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbudget.go
44 lines (36 loc) · 1.38 KB
/
budget.go
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
package budget
import (
"context"
yall "yall.in"
)
//go:generate go-bindata -pkg migrations -o migrations/generated.go sql/
type AccountsStorer interface {
CreateAccount(context.Context, Account) error
GetAccount(context.Context, string) (Account, error)
UpdateAccount(context.Context, string, AccountChange) error
DeleteAccount(context.Context, string) error
ListAccounts(context.Context) ([]Account, error)
}
type AccountsSensitiveDetailsStorer interface {
StoreAccountSensitiveDetails(context.Context, string, AccountSensitiveDetails) error
GetAccountSensitiveDetails(context.Context, string) (AccountSensitiveDetails, error)
DeleteAccountSensitiveDetails(context.Context, string) error
}
type GroupStorer interface {
CreateGroups(context.Context, []Group) error
ListGroups(context.Context) ([]Group, error)
UpdateGroup(context.Context, string, GroupChange) error
}
type TransactionsStorer interface {
ImportTransactions(context.Context, []Transaction) error
ListTransactions(context.Context, TransactionFilters) ([]Transaction, error)
UpdateTransactions(context.Context, TransactionFilters, TransactionChange) error
Balance(context.Context, string) (int64, error)
}
type Dependencies struct {
Log *yall.Logger
Accounts AccountsStorer
AccountsSensitive AccountsSensitiveDetailsStorer
Groups GroupStorer
Transactions TransactionsStorer
}