mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
21 lines
417 B
Go
21 lines
417 B
Go
package treeops
|
|
|
|
import "gopkg.in/yaml.v3"
|
|
|
|
func BuildCandidateNodeFrom(p *PathElement) *CandidateNode {
|
|
var node yaml.Node = yaml.Node{Kind: yaml.ScalarNode}
|
|
node.Value = p.StringValue
|
|
|
|
switch p.Value.(type) {
|
|
case float32, float64:
|
|
node.Tag = "!!float"
|
|
case int, int64, int32:
|
|
node.Tag = "!!int"
|
|
case bool:
|
|
node.Tag = "!!bool"
|
|
case string:
|
|
node.Tag = "!!str"
|
|
}
|
|
return &CandidateNode{Node: &node}
|
|
}
|