当前位置: 首页>>代码示例>>Golang>>正文


Golang Node.SourceName方法代码示例

本文整理汇总了Golang中github.com/cloudfoundry-incubator/spiff/yaml.Node.SourceName方法的典型用法代码示例。如果您正苦于以下问题:Golang Node.SourceName方法的具体用法?Golang Node.SourceName怎么用?Golang Node.SourceName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/cloudfoundry-incubator/spiff/yaml.Node的用法示例。


在下文中一共展示了Node.SourceName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: flowMap

func flowMap(root yaml.Node, env Environment) yaml.Node {
	rootMap := root.Value().(map[string]yaml.Node)

	env = env.WithScope(rootMap)

	newMap := make(map[string]yaml.Node)

	for key, val := range rootMap {
		if key == "<<" {
			base := flow(val, env, true)
			baseMap, ok := base.Value().(map[string]yaml.Node)
			if ok {
				for k, v := range baseMap {
					newMap[k] = v
				}
			}

			continue
		}

		newMap[key] = flow(val, env.WithPath(key), true)
	}

	return yaml.NewNode(newMap, root.SourceName())
}
开发者ID:rdgallagher,项目名称:spiff,代码行数:25,代码来源:flow.go

示例2: flowMap

func flowMap(root yaml.Node, env Environment) yaml.Node {
	rootMap := root.Value().(map[string]yaml.Node)

	env = env.WithScope(rootMap)

	newMap := make(map[string]yaml.Node)

	sortedKeys := getSortedKeys(rootMap)

	// iteration order matters for the "<<" operator, it must be the first key in the map that is handled
	for i := range sortedKeys {
		key := sortedKeys[i]
		val := rootMap[key]

		if key == "<<" {
			base := flow(val, env, true)
			baseMap, ok := base.Value().(map[string]yaml.Node)
			if ok {
				for k, v := range baseMap {
					newMap[k] = v
				}
			}

			continue
		}

		newMap[key] = flow(val, env.WithPath(key), true)
	}

	return yaml.NewNode(newMap, root.SourceName())
}
开发者ID:vincentmisquez,项目名称:spiff,代码行数:31,代码来源:flow.go

示例3: flowList

func flowList(root yaml.Node, env Environment) yaml.Node {
	rootList := root.Value().([]yaml.Node)

	merged := processMerges(rootList, env)

	newList := []yaml.Node{}

	for idx, val := range merged {
		step := stepName(idx, val)
		newList = append(newList, flow(val, env.WithPath(step), false))
	}

	return yaml.NewNode(newList, root.SourceName())
}
开发者ID:rdgallagher,项目名称:spiff,代码行数:14,代码来源:flow.go

示例4: flowString

func flowString(root yaml.Node, env Environment) yaml.Node {
	rootString := root.Value().(string)

	sub := embeddedDynaml.FindStringSubmatch(rootString)
	if sub == nil {
		return root
	}

	expr, err := dynaml.Parse(sub[1], env.Path)
	if err != nil {
		return root
	}

	return yaml.NewNode(expr, root.SourceName())
}
开发者ID:rdgallagher,项目名称:spiff,代码行数:15,代码来源:flow.go


注:本文中的github.com/cloudfoundry-incubator/spiff/yaml.Node.SourceName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。