30 lines
554 B
Go
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")
|
||
|
}
|