/
types.go
92 lines (79 loc) · 2.78 KB
/
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
package pagedata
import "github.com/timdrysdale/gradex-cli/comment"
const (
IsPage = "page"
IsRegion = "region"
IsCover = "cover"
IsMontage = "montage"
IsAnonymous = "anonymous"
IsIdentity = "identity"
)
// Used in triaging files at ingest/staging
type Summary struct {
Is string //page, region, cover-page etc
What string //item
For string //proc
ToDo string //proc
}
// >>>>>>>>>>>>>>>>>>>>> Actual page data >>>>>>>>>>>>>>>>>>>>>>>>
// use an array so that we can decide later that keys to do the mapping of history on
// e.g. we will smash together ALL markers' work, and key on ToDo-Marker-Revision etc.
type PageData struct {
Current PageDetail `json:"current"`
Previous []PageDetail `json:"previous"`
Revision int `json:"revision"`
}
// use custom data for group authorship, if individual authorship must be tracked here
// else use a group id e.g. group-<uuid> which has the individual authors recorded
// elsewhere, along with the original submission.
type PageDetail struct {
Is string `json:"is"` //page, region
Own FileDetail `json:"own"`
Original FileDetail `json:"original"`
Current FileDetail `json:"current"`
Item ItemDetail `json:"item"`
Process ProcessDetail `json:"process"`
UUID string `json:"UUID"` //for mapping the previous page datas later
Follows string `json:"follows"`
Revision int `json:"revision"` //if we want to rewrite history ....
Data []Field `json:"data"`
Comments []comment.Comment `json:"comments"`
OmittedCommentCount int `json:"omittedCommentCount"`
}
type FileDetail struct {
Path string `json:"path"`
UUID string `json:"UUID"`
Number int `json:"number"`
Of int `json:"of"`
}
//whotype exam number:EN matriculation number:UUN etc
type ItemDetail struct {
What string `json:"what"`
When string `json:"when"`
Who string `json:"who"`
UUID string `json:"UUID"`
WhoType string `json:"whoType"`
}
type ProcessDetail struct {
Name string `json:"name"`
UUID string `json:"UUID"` // process batch UUID
UnixTime int64 `json:"unixTime"`
For string `json:"for"`
ToDo string `json:"toDo"`
By string `json:"by"`
Data []Field `json:"data"`
}
type Field struct { //for clarity in code, and brevity in pagedata
Key string `json:"k"`
Value string `json:"v"`
}
const (
StartTag = "<gradex-pagedata>"
EndTag = "</gradex-pagedata>"
StartTagOffset = len(StartTag)
EndTagOffset = len(EndTag)
StartHash = "<hash>"
EndHash = "</hash>"
StartHashOffset = len(StartHash)
EndHashOffset = len(EndHash)
)