timetable-mgr/pis/data.go

30 lines
554 B
Go
Raw Normal View History

2024-10-21 21:04:37 +01:00
package pis
import (
"fmt"
"gopkg.in/yaml.v3"
)
// Process the YAML data to a struct
func processYaml(yamlStr string) (*PisData, error) {
var pis PisData
err := yaml.Unmarshal([]byte(yamlStr), &pis)
if err != nil {
return nil, fmt.Errorf("failed to unmarshal YAML: %v", err)
}
err = deduplicateCodes(&pis)
if err != nil {
return nil, err
}
return &pis, nil
}
// Deduplicate data in place and return error if failed
func deduplicateCodes(pis *PisData) error {
return fmt.Errorf("deduplication logic not present, unable to update")
}