/
zo.go
55 lines (47 loc) · 1.01 KB
/
zo.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
55
package zo
import (
"database/sql"
"time"
)
type Zo struct {
Id int `json:"id"`
AchievementDate time.Time `json:"achievementdate"`
Exp int `json:"exp"`
CategoryId int `json:"categoryid"`
Message string `json:"message"`
CreatedAt time.Time `json:"createdat"`
UpdatedAt sql.NullTime `json:"updatedat"`
}
func NewZo(
id int,
achievementDate time.Time,
exp int,
categoryId int,
message string,
createdAt time.Time,
updatedAt sql.NullTime,
) *Zo {
return &Zo{
Id: id,
AchievementDate: achievementDate,
Exp: exp,
CategoryId: categoryId,
Message: message,
CreatedAt: createdAt,
UpdatedAt: updatedAt}
}
func FindAll() ([]Zo, error) {
return findall()
}
func Find(id int) (*Zo, error) {
return find(id)
}
func Create(zo *Zo) (int, error) {
return create(zo)
}
func (zo *Zo) Update() error {
return update(zo)
}
func Delete(id int) error {
return delete(id)
}