139 lines
4.5 KiB
Go
139 lines
4.5 KiB
Go
package cvdata
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
utils "github.com/jesusperez/datautils"
|
|
)
|
|
|
|
type ProfileType struct {
|
|
Auth AuthInfoType `yaml:"auth" json:"auth"`
|
|
Desc string `yaml:"desc" json:"desc"`
|
|
}
|
|
type CoreProfile struct {
|
|
CoreProfile []ProfileType `yaml:"profile" json:"profile"`
|
|
}
|
|
type SkillsType struct {
|
|
Id string `yaml:"id" json:"id"`
|
|
Auth AuthInfoType `yaml:"auth" json:"auth"`
|
|
Title string `yaml:"title" json:"title"`
|
|
Max int `yaml:"max" json:"max"`
|
|
Value int `yaml:"value" json:"value"`
|
|
}
|
|
type CertificationType struct {
|
|
Id string `yaml:"id" json:"id"`
|
|
Auth AuthInfoType `yaml:"auth" json:"auth"`
|
|
Title string `yaml:"title" json:"title"`
|
|
Author string `yaml:"author" json:"author"`
|
|
Date string `yaml:"date" json:"date"`
|
|
Link string `yaml:"link" json:"link"`
|
|
Href string `yaml:"href" json:"href"`
|
|
Certid string `yaml:"certid" json:"certid"`
|
|
}
|
|
type SitesType struct {
|
|
Id string `yaml:"id" json:"id"`
|
|
Auth AuthInfoType `yaml:"auth" json:"auth"`
|
|
Title string `yaml:"title" json:"title"`
|
|
Sub string `yaml:"sub" json:"sub"`
|
|
Link string `yaml:"link" json:"link"`
|
|
Type string `yaml:"type" json:"type"`
|
|
Alt string `yaml:"alt" json:"alt"`
|
|
Img string `yaml:"img" json:"img"`
|
|
}
|
|
type Sites struct {
|
|
Sites []SitesType `yaml:"sites" json:"sites"`
|
|
}
|
|
type LangsType struct {
|
|
Id string `yaml:"id" json:"id"`
|
|
Title string `yaml:"title" json:"title"`
|
|
Mode string `yaml:"mode" json:"mode"`
|
|
}
|
|
type Langs struct {
|
|
Langs []LangsType `yaml:"langs" json:"langs"`
|
|
}
|
|
type MissionHowType struct {
|
|
Auth AuthInfoType `yaml:"auth" json:"auth"`
|
|
Desc string `yaml:"desc" json:"desc"`
|
|
}
|
|
type DataCoreType struct {
|
|
Name string `yaml:"name" json:"name"`
|
|
Fullname string `yaml:"fullname" json:"fullname"`
|
|
Title1 string `yaml:"title1" json:"title1"`
|
|
Title2 string `yaml:"title2" json:"title2"`
|
|
Imgalt string `yaml:"imgalt" json:"imgalt"`
|
|
Imgsrc string `yaml:"imgsrc" json:"imgsrc"`
|
|
Email string `yaml:"email" json:"email"`
|
|
Phone string `yaml:"phone" json:"phone"`
|
|
Address string `yaml:"address" json:"address"`
|
|
Postalcode string `yaml:"postalcode" json:"postalcode"`
|
|
State string `yaml:"state" json:"state"`
|
|
City string `yaml:"city" json:"city"`
|
|
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"`
|
|
Skills []SkillsType `yaml:"skills" json:"skills"`
|
|
SoftSkills []SkillsType `yaml:"soft_skills" json:"soft_skills"`
|
|
Infra []SkillsType `yaml:"infra" json:"infra"`
|
|
Sites []SitesType `yaml:"sites" json:"sites"`
|
|
Langs []LangsType `yaml:"langs" json:"langs"`
|
|
}
|
|
type DataCore struct {
|
|
Core DataCoreType `yaml:"core" json:"core"`
|
|
}
|
|
type DataLangCoreType struct {
|
|
Title1 string `yaml:"title1" json:"title1"`
|
|
Title2 string `yaml:"title2" json:"title2"`
|
|
Imgalt string `yaml:"imgalt" json:"imgalt"`
|
|
State string `yaml:"state" json:"state"`
|
|
City string `yaml:"city" json:"city"`
|
|
Country string `yaml:"country" json:"country"`
|
|
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"`
|
|
}
|
|
type DataLangCore struct {
|
|
Core DataLangCoreType `yaml:"core" json:"core"`
|
|
}
|
|
func (profileData *CoreProfile)Load(path string) ([]ProfileType, error) {
|
|
d,file,errpath := utils.DecoderFromFile(path)
|
|
if errpath != nil {
|
|
return profileData.CoreProfile, errpath
|
|
}
|
|
defer file.Close()
|
|
if err := d.Decode(&profileData); err != nil {
|
|
fmt.Printf("Decode: %v", err)
|
|
return profileData.CoreProfile, err
|
|
}
|
|
return profileData.CoreProfile, nil
|
|
}
|
|
func (datacore *DataCore)Load(path string) (DataCoreType, error) {
|
|
d,file,errpath := utils.DecoderFromFile(path)
|
|
if errpath != nil {
|
|
return datacore.Core, errpath
|
|
}
|
|
defer file.Close()
|
|
if err := d.Decode(&datacore); err != nil {
|
|
fmt.Printf("Decode: %v", err)
|
|
return datacore.Core, err
|
|
}
|
|
return datacore.Core, nil
|
|
}
|
|
func(datalangcore *DataLangCore)Load(path string) (DataLangCoreType, error) {
|
|
d,file,errpath := utils.DecoderFromFile(path)
|
|
if errpath != nil {
|
|
return datalangcore.Core, errpath
|
|
}
|
|
defer file.Close()
|
|
if err := d.Decode(&datalangcore); err != nil {
|
|
fmt.Printf("Decode: %v", err)
|
|
return datalangcore.Core, err
|
|
}
|
|
return datalangcore.Core, nil
|
|
}
|