lib-cvdata/datalang.go
2022-01-10 13:01:15 +00:00

41 lines
1.3 KiB
Go

package cvdata
import (
"fmt"
utils "github.com/jesusperez/datautils"
)
type DataLangType struct {
Imgalt string `yaml:"imgalt" json:"imgalt"`
Title1 string `yaml:"title1" json:"title1"`
Title2 string `yaml:"title2" json:"title2"`
Country string `yaml:"country" json:"country"`
Birthdate string `yaml:"birthdate" json:"birthdate"`
Status string `yaml:"status" json:"status"`
Mission string `yaml:"mission" json:"mission"`
Mission_how []MissionHowType `yaml:"mission_how" json:"mission_how"`
Profile []ProfileType `yaml:"profile" json:"profile"`
Certifications []CertificationType `yaml:"certifications" json:"certifications"`
Work_experiences []WorkExperienceType `yaml:"work_experiences" json:"work_experiences"`
Projects []ProjectType `yaml:"projects" json:"projects"`
Education []EducationType `yaml:"education" json:"education"`
Talks []TalksType `yaml:"talks" json:"talks"`
Teaching []TeachingType `yaml:"teaching" json:"teaching"`
Others []OtherType `yaml:"others" json:"others"`
}
func loadDataLang(path string) (*DataLangType, error) {
datalang := &DataLangType{}
d,file,errpath := utils.DecoderFromFile(path)
if errpath != nil {
return nil, errpath
}
defer file.Close()
if err := d.Decode(&datalang); err != nil {
fmt.Printf("Decode: %v", err)
return nil, err
}
return datalang, nil
}