-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
54 lines (45 loc) · 1.02 KB
/
types.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
45
46
47
48
49
50
51
52
53
54
package todo
import "embed"
// must used from here to embed static dir. can not use ./ ../ in embed
//go:embed static
var Static embed.FS
//go:embed certs
var Certs embed.FS
type Task struct {
Id int
Description string
Status string
}
type Config struct {
Cleanup bool
LogHttp bool
DB string
}
var ProductionCfg = Config{
Cleanup: false,
LogHttp: true,
DB: "./todo.db",
}
var TestCfg = Config{
Cleanup: true,
LogHttp: false,
DB: "./test.db",
}
type Counts struct {
Total int
Completed int
}
type Store interface {
Migrate() error
InsertTask(description string) (Task, error)
GetTasks(filter Task) ([]Task, error)
UpdateTask(id int, description string) (Task, error)
GetTaskById(id int) (Task, error)
DeleteTask(id int) error
ToggleTaskStatus(id int) (Task, error)
GetTasksByStatus(status string) ([]Task, error)
GetTasksCount() (int, error)
GetCompletedTasksCount() (int, error)
GetTasksCounters() (int, int, error)
ToggleAndAnimationData(id int) (Counts, Task, int, error)
}