lib-cvdata/work_experience.go

48 lines
1.6 KiB
Go

package cvdata
import (
"fmt"
utils "github.com/jesusperez/datautils"
)
type WorkExperienceType struct {
Auth AuthInfoType `yaml:"auth" json:"auth"`
Date string `yaml:"date" json:"date"`
Where string `yaml:"where" json:"where"`
Wheredef string `yaml:"wheredef" json:"wheredef"`
Location string `yaml:"location" json:"location"`
Position string `yaml:"position" json:"position"`
Description string `yaml:"description" json:"description"`
Tools []string `yaml:"tools" json:"tools"`
Achievements []string `yaml:"achievements" json:"achievements"`
Tasks []string `yaml:"tasks" json:"tasks"`
}
type WorkExperience struct {
WorkExperience []WorkExperienceType `yaml:"work_experience" json:"work_experience"`
}
type ShowWorkExperienceType struct {
Auth AuthInfoType `yaml:"auth" json:"auth"`
Date bool `yaml:"date" json:"date"`
Where bool `yaml:"where" json:"where"`
Wheredef bool `yaml:"wheredef" json:"wheredef"`
Location bool `yaml:"location" json:"location"`
Position bool `yaml:"position" json:"position"`
Description bool `yaml:"description" json:"description"`
Tools bool `yaml:"tools" json:"tools"`
Achievements bool `yaml:"achievements" json:"achievements"`
Tasks bool `yaml:"tasks" json:"tasks"`
}
func (experience *WorkExperience)Load(path string) ([]WorkExperienceType, error) {
d,file,errpath := utils.DecoderFromFile(path)
if errpath != nil {
return experience.WorkExperience, errpath
}
defer file.Close()
if err := d.Decode(&experience); err != nil {
fmt.Printf("Decode: %v", err)
return experience.WorkExperience, err
}
return experience.WorkExperience, nil
}