/
struct.go
45 lines (39 loc) · 1.12 KB
/
struct.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
package main
import (
"html/template"
"time"
)
type User struct {
ID int64 `json:"-" db:"id"`
Name string `json:"name" db:"name"`
Salt string `json:"-" db:"salt"`
Password string `json:"-" db:"password"`
DisplayName string `json:"display_name" db:"display_name"`
AvatarIcon string `json:"avatar_icon" db:"avatar_icon"`
CreatedAt time.Time `json:"-" db:"created_at"`
}
type Message struct {
ID int64 `db:"id"`
ChannelID int64 `db:"channel_id"`
UserID int64 `db:"user_id"`
Content string `db:"content"`
CreatedAt time.Time `db:"created_at"`
User User
}
type ChannelInfo struct {
ID int64 `db:"id"`
Name string `db:"name"`
Description string `db:"description"`
UpdatedAt time.Time `db:"updated_at"`
CreatedAt time.Time `db:"created_at"`
}
type Renderer struct {
templates *template.Template
}
type HaveRead struct {
UserID int64 `db:"user_id"`
ChannelID int64 `db:"channel_id"`
MessageID int64 `db:"message_id"`
UpdatedAt time.Time `db:"updated_at"`
CreatedAt time.Time `db:"created_at"`
}