timetable-mgr/pis/data.go
Fred Boniface 8f0e9759c4
Some checks failed
Go Test / test (push) Failing after 2m10s
Add PIS Logic
2024-10-21 21:04:37 +01:00

30 lines
554 B
Go

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")
}