Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for SetNestedStringSlice (0.15 sec)

  1. staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go

    	if u.Object == nil {
    		u.Object = make(map[string]interface{})
    	}
    	SetNestedField(u.Object, value, fields...)
    }
    
    func (u *Unstructured) setNestedStringSlice(value []string, fields ...string) {
    	if u.Object == nil {
    		u.Object = make(map[string]interface{})
    	}
    	SetNestedStringSlice(u.Object, value, fields...)
    }
    
    func (u *Unstructured) setNestedSlice(value []interface{}, fields ...string) {
    	if u.Object == nil {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sun May 28 03:26:35 UTC 2023
    - 13.7K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers_test.go

    }
    
    func TestSetNestedStringSlice(t *testing.T) {
    	obj := map[string]interface{}{
    		"x": map[string]interface{}{
    			"y": 1,
    			"a": "foo",
    		},
    	}
    
    	err := SetNestedStringSlice(obj, []string{"bar"}, "x", "z")
    	assert.NoError(t, err)
    	assert.Len(t, obj["x"], 3)
    	assert.Len(t, obj["x"].(map[string]interface{})["z"], 1)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Nov 24 07:53:28 UTC 2021
    - 5.9K bytes
    - Viewed (0)
  3. staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go

    			m[field] = newVal
    			m = newVal
    		}
    	}
    	m[fields[len(fields)-1]] = value
    	return nil
    }
    
    // SetNestedStringSlice sets the string slice value of a nested field.
    // Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}.
    func SetNestedStringSlice(obj map[string]interface{}, value []string, fields ...string) error {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Jun 29 20:39:55 UTC 2023
    - 16.3K bytes
    - Viewed (0)
Back to top