-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.go
95 lines (79 loc) · 2.09 KB
/
schema.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
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
package models
import (
"github.com/google/uuid"
"gorm.io/gorm"
)
type Session struct {
gorm.Model
UUID uuid.UUID `gorm:"uniqueIndex;type:byte"`
UA string `gorm:"not null"`
Language string `gorm:"not null"`
IP string `gorm:"not null"`
AppVersion string
URL string `gorm:"not null"`
Screen string `gorm:"not null"`
Referrer string
Meta string
JSErrors []JSError `gorm:"foreignKey:SessionUUID"`
HTTPs []HTTP `gorm:"foreignKey:SessionUUID"`
Events []Event `gorm:"foreignKey:SessionUUID"`
Performances []Performance `gorm:"foreignKey:SessionUUID"`
PageViews []PageView `gorm:"foreignKey:SessionUUID"`
}
type JSError struct {
gorm.Model
Name string `gorm:"not null"`
Message string `gorm:"not null"`
Stack string `gorm:"not null"`
Cause string
SessionUUID uuid.UUID `gorm:"not null"`
Session Session `gorm:"references:UUID"`
}
type HTTP struct {
gorm.Model
Resource string `gorm:"not null"`
Method string `gorm:"not null"`
Headers string `gorm:"not null"`
Status int `gorm:"not null"`
Body string
Response string
SessionUUID uuid.UUID `gorm:"not null"`
Session Session `gorm:"references:UUID"`
}
type Event struct {
gorm.Model
Action string `gorm:"not null"`
Value string `gorm:"not null"`
SessionUUID uuid.UUID `gorm:"not null"`
Session Session `gorm:"references:UUID"`
}
type Performance struct {
gorm.Model
Name string `gorm:"not null"`
Value float64 `gorm:"not null"`
URL string `gorm:"not null"`
SessionUUID uuid.UUID `gorm:"not null"`
Session Session `gorm:"references:UUID"`
}
type PageView struct {
gorm.Model
URL string `gorm:"not null"`
SessionUUID uuid.UUID `gorm:"not null"`
Session Session `gorm:"references:UUID"`
}
type User struct {
gorm.Model
Name string `gorm:"not null;unique"`
Password string `gorm:"not null"`
Role int `gorm:"not null"`
}
type Config struct {
gorm.Model
Key string `gorm:"not null;unique"`
Value string `gorm:"not null"`
}
const (
LCP = "LCP"
CLS = "CLS"
FID = "FID"
)