File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change 1
1
package inserter
2
2
3
+ // Model - JSONやYAMLのモデル
3
4
type Model struct {
4
5
Version string `json:"version" yaml:"version"`
5
6
Items []ModelItem `json:"items" yaml:"version"`
6
7
}
7
8
9
+ // ModelItem - Modelが持つアイテム
8
10
type ModelItem struct {
9
11
Ref string `json:"ref" yaml:"ref"`
10
12
Payload map [string ]interface {} `json:"payload" yaml:"payload"`
Original file line number Diff line number Diff line change @@ -8,16 +8,19 @@ import (
8
8
"gopkg.in/yaml.v2"
9
9
)
10
10
11
+ // YAMLInserter - InserterのYAML実装
11
12
type YAMLInserter struct {
12
13
ci * CommonInserter
13
14
}
14
15
16
+ // NewYAMLInserter - YAMLInserter constructor
15
17
func NewYAMLInserter (ci * CommonInserter ) * YAMLInserter {
16
18
return & YAMLInserter {
17
19
ci : ci ,
18
20
}
19
21
}
20
22
23
+ // Execute - YAMLを読み込んでアイテムを生成する
21
24
func (y * YAMLInserter ) Execute (ctx context.Context , cn , path string ) error {
22
25
yb , err := os .ReadFile (path )
23
26
if err != nil {
You can’t perform that action at this time.
0 commit comments