reprogl
1package container2
3import (4_ "embed"5"strings"6
7"github.com/BurntSushi/toml"8)
9
10type AppData struct {11HeaderText string `toml:"header_text"`12Author Author `toml:"author"`13
14AuthorLocationRu Location `toml:"author_location"`15AuthorLocationEn Location `toml:"author_location_en"`16
17Jobs JobHistory `toml:"jobs"`18}
19
20type Author struct {21FullName string `toml:"fn"`22Bio string `toml:"bio"`23Email string `toml:"email"`24
25GithubUser string `toml:"github"`26TelegramChannel string `toml:"telegram"`27MastodonLink string `toml:"mastodon"`28GitVerseUser string `toml:"gitverse"`29}
30
31type Location struct {32City string `toml:"city"`33Region string `toml:"region"`34Country string `toml:"country"`35}
36
37var (38//go:embed app_data.toml39dataSource string40)
41
42func loadAppData() AppData {43var data AppData44_, err := toml.Decode(dataSource, &data)45if err != nil {46panic(err)47}48
49return data50}
51
52func (l Location) String() string {53s := make([]string, 0, 3)54
55if l.City != "" {56s = append(s, l.City)57}58if l.Region != "" {59s = append(s, l.Region)60}61if l.Country != "" {62s = append(s, l.Country)63}64
65return strings.Join(s, ", ")66}
67