lib-cvdata/talks.go
2024-09-16 20:35:48 +01:00

42 lines
1.0 KiB
Go

package cvdata
import (
"fmt"
utils "github.com/jesusperez/datautils"
)
type TalksType struct {
Auth AuthInfoType `yaml:"auth" json:"auth"`
Date string `yaml:"date" json:"date"`
Title string `yaml:"title" json:"title"`
Org string `yaml:"org" json:"org"`
Location string `yaml:"location" json:"location"`
Description []string `yaml:"description" json:"description"`
}
type Talks struct {
Talks []TalksType `yaml:"talks" json:"talks"`
}
type ShowTalksType struct {
Auth AuthInfoType `yaml:"auth" json:"auth"`
Date bool `yaml:"date" json:"date"`
Title bool `yaml:"title" json:"title"`
Org bool `yaml:"org" json:"org"`
Location bool `yaml:"location" json:"location"`
Description bool `yaml:"description" json:"description"`
}
func (talks *Talks)Load(path string) ([]TalksType, error) {
d,file,errpath := utils.DecoderFromFile(path)
if errpath != nil {
return talks.Talks, errpath
}
defer file.Close()
if err := d.Decode(&talks); err != nil {
fmt.Printf("Decode: %v", err)
return talks.Talks, err
}
return talks.Talks, nil
}