Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for IsKVPathElement (0.53 sec)

  1. operator/pkg/util/path.go

    }
    
    // IsValidPathElement reports whether pe is a valid path element.
    func IsValidPathElement(pe string) bool {
    	return ValidKeyRegex.MatchString(pe)
    }
    
    // IsKVPathElement report whether pe is a key/value path element.
    func IsKVPathElement(pe string) bool {
    	pe, ok := RemoveBrackets(pe)
    	if !ok {
    		return false
    	}
    
    	kv := splitEscaped(pe, kvSeparatorRune)
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Dec 12 17:12:54 UTC 2023
    - 5.5K bytes
    - Viewed (0)
  2. operator/pkg/translate/translate.go

    	if len(path) == 0 {
    		return nil, fmt.Errorf("empty path %s", path)
    	}
    	if util.IsKVPathElement(path[0]) {
    		return nil, fmt.Errorf("path %s has an unexpected first element %s", path, path[0])
    	}
    	length := len(path)
    	if util.IsKVPathElement(path[length-1]) {
    		return nil, fmt.Errorf("path %s has an unexpected last element %s", path, path[length-1])
    	}
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Feb 12 19:43:09 UTC 2024
    - 36.3K bytes
    - Viewed (0)
  3. operator/pkg/util/path_test.go

    			expect: false,
    		},
    		{
    			desc:   "one-bracket",
    			in:     "[1:2",
    			expect: false,
    		},
    	}
    
    	for _, tt := range tests {
    		t.Run(tt.desc, func(t *testing.T) {
    			if got := IsKVPathElement(tt.in); got != tt.expect {
    				t.Errorf("%s: expect %v got %v", tt.desc, tt.expect, got)
    			}
    		})
    	}
    }
    
    func TestIsVPathElement(t *testing.T) {
    	tests := []struct {
    		desc   string
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Sat Aug 29 00:15:38 UTC 2020
    - 6.7K bytes
    - Viewed (0)
  4. operator/pkg/tpath/tree.go

    		return nc, true, nil
    	}
    	pe := remainPath[0]
    
    	if nc.Node == nil {
    		if !createMissing {
    			return nil, false, fmt.Errorf("node %s is zero", pe)
    		}
    		if util.IsNPathElement(pe) || util.IsKVPathElement(pe) {
    			nc.Node = []any{}
    		} else {
    			nc.Node = make(map[string]any)
    		}
    	}
    
    	v := reflect.ValueOf(nc.Node)
    	if v.Kind() == reflect.Ptr || v.Kind() == reflect.Interface {
    		v = v.Elem()
    	}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue May 23 17:08:31 UTC 2023
    - 17.5K bytes
    - Viewed (0)
Back to top