我正在尝试使用Go YAML v3解组以下 YAML 。
model:
name: mymodel
default-children:
- payment
pipeline:
accumulator_v1:
by-type:
type: static
value: false
result-type:
type: static
value: 3
item_v1:
amount:
type: schema-path
value: amount
start-date:
type: schema-path
value: start-date
在管道下是任意数量的有序项目。应该将其解组的结构如下所示:
type PipelineItemOption struct {
Type string
Value interface{}
}
type PipelineItem struct {
Options map[string]PipelineItemOption
}
type Model struct {
Name string
DefaultChildren []string `yaml:"default-children"`
Pipeline orderedmap[string]PipelineItem // "pseudo code"
}
这如何与 Golang YAML v3 一起使用?在 v2 中有 MapSlice,但在 v3 中没有了。
慕的地10843
米琪卡哇伊
相关分类