package cvdata import ( "fmt" utils "github.com/jesusperez/datautils" ) type ProjectType struct { Auth AuthInfoType `yaml:"auth" json:"auth"` Date string `yaml:"date" json:"date"` Name string `yaml:"name" json:"name"` Title string `yaml:"title" json:"title"` Img string `yaml:"img" json:"img"` Site string `yaml:"site" json:"site"` Code string `yaml:"code" json:"code"` Purpose string `yaml:"purpose" json:"purpose"` For string `yaml:"for" json:"for"` Position string `yaml:"position" json:"position"` License string `yaml:"license" json:"license"` Demo string `yaml:"demo" json:"demo"` Capture string `yaml:"capture" json:"capture"` Description string `yaml:"description" json:"description"` Features []string `yaml:"features" json:"features"` Builtwith []string `yaml:"builtwith" json:"builtwith"` } type Projects struct { Projects []ProjectType `yaml:"projects" json:"projects"` } type ShowProjectType struct { Auth AuthInfoType `yaml:"auth" json:"auth"` Name bool `yaml:"name" json:"name"` Title bool `yaml:"title" json:"title"` Img bool `yaml:"img" json:"img"` Purpose bool `yaml:"purpose" json:"purpose"` Site bool `yaml:"site" json:"site"` Code bool `yaml:"code" json:"code"` Date bool `yaml:"date" json:"date"` For bool `yaml:"for" json:"for"` Position bool `yaml:"position" json:"position"` License bool `yaml:"license" json:"license"` Demo bool `yaml:"demo" json:"demo"` Capture bool `yaml:"capture" json:"capture"` Description bool `yaml:"description" json:"description"` Features bool `yaml:"features" json:"features"` Builtwith bool `yaml:"builtwith" json:"builtwith"` } func (projects *Projects)Load(path string) ([]ProjectType, error) { d,file,errpath := utils.DecoderFromFile(path) if errpath != nil { return projects.Projects, errpath } defer file.Close() if err := d.Decode(&projects); err != nil { fmt.Printf("Decode: %v", err) return projects.Projects, err } return projects.Projects, nil }