func (step *Step) RemoveLogQuery() *Step {
	xmlMap := step.Value

	keyPath := xmlMap.PathForKeyShortest("-id")
	parentPath := ParentPath(keyPath)
	pathValues, _ := xmlMap.ValuesForPath(parentPath)

	var key int
	if gd.IsSlice(pathValues) {
		for i, pathValue := range pathValues {
			if pathValue.(map[string]interface{})["-id"] == "logQuery" {
				key = i
			}
		}
	}

	var gl gd.GdList
	gl.Value = pathValues
	Pgl := &gl
	Pgl.New()
	Pgl.Remove(key).Sync()

	xmlMap.SetValueForPath((&(gd.GdInterface{Pgl.Value})).Value, parentPath)

	return step
}
Exemplo n.º 2
0
func ParentPath(path string) string {
	var gl gd.GdList
	gi := gd.GdInterface{strings.Split(path, ".")}
	gl.Value = (&gi).ToInterfaces()
	Pgl := &gl

	Pgl.New()
	Pgl.Pop()
	Pgl.Sync()

	ss := (&(gd.GdInterfaces{Pgl.Value})).ToStrings()
	r := strings.Join(ss, ".")

	return r
}