-
Notifications
You must be signed in to change notification settings - Fork 4
/
models.go
155 lines (135 loc) · 3.38 KB
/
models.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.16.0
package db
import (
"database/sql"
"database/sql/driver"
"fmt"
"github.com/google/uuid"
"github.com/jackc/pgtype"
)
type AccessTokenScope string
const (
AccessTokenScopeAdmin AccessTokenScope = "admin"
AccessTokenScopeControl AccessTokenScope = "control"
AccessTokenScopeData AccessTokenScope = "data"
AccessTokenScopeRunner AccessTokenScope = "runner"
)
func (e *AccessTokenScope) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = AccessTokenScope(s)
case string:
*e = AccessTokenScope(s)
default:
return fmt.Errorf("unsupported scan type for AccessTokenScope: %T", src)
}
return nil
}
type NullAccessTokenScope struct {
AccessTokenScope AccessTokenScope
Valid bool // Valid is true if AccessTokenScope is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullAccessTokenScope) Scan(value interface{}) error {
if value == nil {
ns.AccessTokenScope, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.AccessTokenScope.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullAccessTokenScope) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return ns.AccessTokenScope, nil
}
type RunResult string
const (
RunResultUnknown RunResult = "unknown"
RunResultPass RunResult = "pass"
RunResultFail RunResult = "fail"
RunResultError RunResult = "error"
)
func (e *RunResult) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = RunResult(s)
case string:
*e = RunResult(s)
default:
return fmt.Errorf("unsupported scan type for RunResult: %T", src)
}
return nil
}
type NullRunResult struct {
RunResult RunResult
Valid bool // Valid is true if RunResult is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullRunResult) Scan(value interface{}) error {
if value == nil {
ns.RunResult, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.RunResult.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullRunResult) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return ns.RunResult, nil
}
type AccessToken struct {
ID uuid.UUID
Name string
TokenHash string
Scopes []AccessTokenScope
IssuedAt sql.NullTime
ExpiresAt sql.NullTime
RevokedAt sql.NullTime
NamespaceSelectors []string
}
type Run struct {
ID uuid.UUID
TestID uuid.UUID
TestRunConfig pgtype.JSONB
TestMatrixID uuid.NullUUID
Labels pgtype.JSONB
RunnerID uuid.NullUUID
Result NullRunResult
Logs pgtype.JSONB
ResultData pgtype.JSONB
ScheduledAt sql.NullTime
StartedAt sql.NullTime
FinishedAt sql.NullTime
}
type Runner struct {
ID uuid.UUID
Name string
AcceptTestLabelSelectors pgtype.JSONB
RejectTestLabelSelectors pgtype.JSONB
RegisteredAt sql.NullTime
LastHeartbeatAt sql.NullTime
NamespaceSelectors []string
}
type SchemaMigration struct {
Version string
}
type Test struct {
ID uuid.UUID
Name string
RunConfig pgtype.JSONB
Labels pgtype.JSONB
Matrix pgtype.JSONB
CronSchedule sql.NullString
NextRunAt sql.NullTime
RegisteredAt sql.NullTime
UpdatedAt sql.NullTime
Namespace string
}