This repository has been archived by the owner on Dec 27, 2022. It is now read-only.
/
model.go
73 lines (62 loc) · 2.42 KB
/
model.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
package parse
import (
"time"
)
const CurrentArtifactVersion = 2
const ArtifactFileExtension = ".md"
type GenericEntry map[string]interface{}
type Artifact struct {
Path string `json:"path"`
Slug string `json:"slug"`
Commit *ArtifactCommit `json:"commit"`
Entry GenericEntry `json:"entry"`
}
type ArtifactCommit struct {
Rev string `json:"rev"`
Date time.Time `json:"date"`
}
type ArtifactEntryFile struct {
Name string `yaml:"name" json:"name"`
MediaType *string `yaml:"mediaType" json:"mediaType"`
Filename *string `yaml:"filename" json:"filename"`
Cid string `yaml:"cid" json:"cid"`
}
type ArtifactEntryLink struct {
Name string `yaml:"name" json:"name"`
Url string `yaml:"url" json:"url"`
}
type ArtifactEntry struct {
Version int `yaml:"version" json:"version"`
Title string `yaml:"title" json:"title"`
Description string `yaml:"description" json:"description"`
LongDescription *string `yaml:"longDescription" json:"longDescription"`
Files []ArtifactEntryFile `yaml:"files" json:"files"`
Links []ArtifactEntryLink `yaml:"links" json:"links"`
People []string `yaml:"people" json:"people"`
Identities []string `yaml:"identities" json:"identities"`
FromYear int `yaml:"fromYear" json:"fromYear"`
ToYear *int `yaml:"toYear" json:"toYear"`
Decades []int `yaml:"decades" json:"decades"`
Aliases []string `yaml:"aliases" json:"aliases"`
}
type EntryField string
const (
FieldVersion EntryField = "version"
FieldTitle EntryField = "title"
FieldDescription EntryField = "description"
FieldLongDescription EntryField = "longDescription"
FieldFiles EntryField = "files"
FieldFileName EntryField = "name"
FieldFileMediaType EntryField = "mediaType"
FieldFileFilename EntryField = "filename"
FieldFileCid EntryField = "cid"
FieldLinks EntryField = "links"
FieldLinkName EntryField = "name"
FieldLinkUrl EntryField = "url"
FieldPeople EntryField = "people"
FieldIdentities EntryField = "identities"
FieldFromYear EntryField = "fromYear"
FieldToYear EntryField = "toYear"
FieldDecades EntryField = "decades"
FieldAliases EntryField = "aliases"
)