-
Notifications
You must be signed in to change notification settings - Fork 11
/
server_types.go
159 lines (133 loc) · 3.96 KB
/
server_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
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
156
157
158
159
package dbhub
import (
"time"
)
type APIJSONColumn struct {
Cid int `json:"column_id"`
Name string `json:"name"`
DataType string `json:"data_type"`
NotNull bool `json:"not_null"`
DfltValue string `json:"default_value"`
Pk int `json:"primary_key"`
}
type APIJSONIndexColumn struct {
CID int `json:"id"`
Name string `json:"name"`
}
type APIJSONIndex struct {
Name string `json:"name"`
Table string `json:"table"`
Columns []APIJSONIndexColumn `json:"columns"`
}
type BranchEntry struct {
Commit string `json:"commit"`
CommitCount int `json:"commit_count"`
Description string `json:"description"`
}
type BranchListResponseContainer struct {
Branches map[string]BranchEntry `json:"branches"`
DefaultBranch string `json:"default_branch"`
}
type CommitEntry struct {
AuthorEmail string `json:"author_email"`
AuthorName string `json:"author_name"`
CommitterEmail string `json:"committer_email"`
CommitterName string `json:"committer_name"`
ID string `json:"id"`
Message string `json:"message"`
OtherParents []string `json:"other_parents"`
Parent string `json:"parent"`
Timestamp time.Time `json:"timestamp"`
Tree DBTree `json:"tree"`
}
type ValType int
const (
Binary ValType = iota
Image
Null
Text
Integer
Float
)
type DataValue struct {
Name string
Type ValType
Value interface{}
}
type DataRow []DataValue
type DBTree struct {
ID string `json:"id"`
Entries []DBTreeEntry `json:"entries"`
}
type DBTreeEntryType string
const (
TREE DBTreeEntryType = "tree"
DATABASE = "db"
LICENCE = "licence"
)
type DBTreeEntry struct {
EntryType DBTreeEntryType `json:"entry_type"`
LastModified time.Time `json:"last_modified"`
LicenceSHA string `json:"licence"`
Name string `json:"name"`
Sha256 string `json:"sha256"`
Size int64 `json:"size"`
}
type ExecuteResponseContainer struct {
RowsChanged int `json:"rows_changed"`
Status string `json:"status"`
}
type MetadataResponseContainer struct {
Branches map[string]BranchEntry `json:"branches"`
Commits map[string]CommitEntry `json:"commits"`
DefBranch string `json:"default_branch"`
Releases map[string]ReleaseEntry `json:"releases"`
Tags map[string]TagEntry `json:"tags"`
WebPage string `json:"web_page"`
}
type ReleaseEntry struct {
Commit string `json:"commit"`
Date time.Time `json:"date"`
Description string `json:"description"`
ReleaserEmail string `json:"email"`
ReleaserName string `json:"name"`
Size int64 `json:"size"`
}
type TagEntry struct {
Commit string `json:"commit"`
Date time.Time `json:"date"`
Description string `json:"description"`
TaggerEmail string `json:"email"`
TaggerName string `json:"name"`
}
type WebpageResponseContainer struct {
WebPage string `json:"web_page"`
}
type DiffType string
const (
ActionAdd DiffType = "add"
ActionDelete DiffType = "delete"
ActionModify DiffType = "modify"
)
type SchemaDiff struct {
ActionType DiffType `json:"action_type"`
Sql string `json:"sql,omitempty"`
Before string `json:"before"`
After string `json:"after"`
}
type DataDiff struct {
ActionType DiffType `json:"action_type"`
Sql string `json:"sql,omitempty"`
Pk []DataValue `json:"pk"`
DataBefore []interface{} `json:"data_before,omitempty"`
DataAfter []interface{} `json:"data_after,omitempty"`
}
type DiffObjectChangeset struct {
ObjectName string `json:"object_name"`
ObjectType string `json:"object_type"`
Schema *SchemaDiff `json:"schema,omitempty"`
Data []DataDiff `json:"data,omitempty"`
}
type Diffs struct {
Diff []DiffObjectChangeset `json:"diff"`
}