/
resumeData.go
116 lines (99 loc) · 2.71 KB
/
resumeData.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
package data
import (
"io/ioutil"
"time"
"gopkg.in/yaml.v2"
"github.com/jsorrell/www.jacksorrell.com/data"
)
type month struct {
Month string `yaml:"month"`
Year string `yaml:"year"`
}
// ResumeData contains all data in resume.yaml used to build /resume/.
type ResumeData struct {
Profile struct {
Name struct {
First string `yaml:"first"`
Last string `yaml:"last"`
} `yaml:"name"`
Title string `yaml:"title"`
Birthdate time.Time `yaml:"birthdate"`
Residence struct {
City string `yaml:"city"`
State string `yaml:"state"`
Country string `yaml:"country"`
} `yaml:"residence"`
Bio string `yaml:"bio"`
} `yaml:"profile"`
Degrees []struct {
Name string `yaml:"name"`
StartDate month `yaml:"startDate"`
EndDate month `yaml:"endDate"`
Location struct {
City string `yaml:"city"`
State string `ymal:"state"`
} `yaml:"location"`
Type string `yaml:"type"`
Degree string `yaml:"degree"`
DegreeShort string `yaml:"degreeShort"`
Major string `yaml:"major"`
Minors []string `yaml:"minors"`
} `yaml:"degrees"`
CourseCategories []struct {
Category string `yaml:"category"`
Courses []struct {
Name string `yaml:"name"`
ShortName string `yaml:"shortName"`
ID string `yaml:"id"`
Description string `yaml:"description"`
} `yaml:"courses"`
} `yaml:"courseCategories"`
Experiences []struct {
Title string `yaml:"title"`
Company string `yaml:"company"`
Location struct {
City string `yaml:"city"`
State string `yaml:"state"`
} `yaml:"location"`
StartDate month `yaml:"startDate"`
EndDate month `yaml:"endDate"`
Description string `yaml:"description"`
} `yaml:"experiences"`
Projects []struct {
Name string `yaml:"name"`
StartDate month `yaml:"startDate"`
EndDate month `yaml:"endDate"`
Description string `yaml:"description"`
} `yaml:"projects"`
SkillCategories []struct {
Category string `yaml:"category"`
Skills []struct {
Name string `yaml:"name"`
Level int `yaml:"level"`
} `yaml:"skills"`
} `yaml:"skillCategories"`
Links []struct {
Name string `yaml:"name"`
Icon string `yaml:"icon"`
Href string `yaml:"href"`
} `yaml:"links"`
UpdatedDate string `yaml:"updatedDate"`
}
// ParseResumeData parses resume.yaml and returns the data.
func ParseResumeData() (*ResumeData, error) {
resumeDataYaml, err := data.Assets.Open("resume_data.yaml")
if err != nil {
return nil, err
}
defer resumeDataYaml.Close()
resumeDataBytes, err := ioutil.ReadAll(resumeDataYaml)
if err != nil {
return nil, err
}
var data ResumeData
err = yaml.Unmarshal(resumeDataBytes, &data)
if err != nil {
return nil, err
}
return &data, nil
}