Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for NewMapValue (0.13 sec)

  1. staging/src/k8s.io/apiserver/pkg/cel/value_test.go

    	}
    }
    
    func TestMapValueNotEqual(t *testing.T) {
    	mv := NewMapValue()
    	name := NewField(1, "name")
    	name.Ref = testValue(t, 2, "alert")
    	priority := NewField(3, "priority")
    	priority.Ref = testValue(t, 4, int64(4))
    	mv.AddField(name)
    	mv.AddField(priority)
    
    	mv2 := NewMapValue()
    	mv2.AddField(name)
    	if mv.Equal(mv2) != types.False {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Oct 10 22:05:55 UTC 2022
    - 10.4K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel/model/types_test.go

    	}
    
    	// Manually constructed instance of the schema.
    	name := apiservercel.NewField(1, "name")
    	name.Ref = testValue(t, 2, "test-instance")
    	nestedVal := apiservercel.NewMapValue()
    	flags := apiservercel.NewField(5, "flags")
    	flagsVal := apiservercel.NewMapValue()
    	myFlag := apiservercel.NewField(6, "my_flag")
    	myFlag.Ref = testValue(t, 7, true)
    	flagsVal.AddField(myFlag)
    	flags.Ref = testValue(t, 8, flagsVal)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon May 08 15:52:31 UTC 2023
    - 3.8K bytes
    - Viewed (0)
  3. staging/src/k8s.io/apiserver/pkg/cel/lazy/lazy_test.go

    	"k8s.io/apiserver/pkg/cel/environment"
    )
    
    func TestLazyMapType(t *testing.T) {
    	env, variablesType, err := buildTestEnv()
    	if err != nil {
    		t.Fatal(err)
    	}
    	variablesMap := NewMapValue(variablesType)
    	activation := &testActivation{variables: variablesMap}
    
    	// add foo as a string
    	variablesType.Fields["foo"] = apiservercel.NewDeclField("foo", apiservercel.StringType, true, nil, nil)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri May 10 22:07:40 UTC 2024
    - 4.6K bytes
    - Viewed (0)
  4. staging/src/k8s.io/apiserver/pkg/cel/lazy/lazy.go

    	// callbacks are a map of field name to the function that returns the field Val
    	callbacks map[string]GetFieldFunc
    	// knownValues are registered names, used for iteration
    	knownValues []string
    }
    
    func NewMapValue(objectType ref.Type) *MapValue {
    	return &MapValue{
    		typeValue: types.NewTypeValue(objectType.TypeName(), traits.IndexerType|traits.FieldTesterType|traits.IterableType),
    		values:    map[string]ref.Val{},
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Aug 23 21:31:27 UTC 2023
    - 4.9K bytes
    - Viewed (0)
  5. staging/src/k8s.io/apiserver/pkg/admission/plugin/cel/composition.go

    }
    
    type compositionContext struct {
    	context.Context
    
    	compositionEnv  *CompositionEnv
    	accumulatedCost int64
    }
    
    func (c *compositionContext) Variables(activation any) ref.Val {
    	lazyMap := lazy.NewMapValue(c.compositionEnv.MapType)
    	for name, result := range c.compositionEnv.CompiledVariables {
    		accessor := &variableAccessor{
    			name:       name,
    			result:     result,
    			activation: activation,
    			context:    c,
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Feb 13 21:06:39 UTC 2024
    - 7.4K bytes
    - Viewed (0)
  6. staging/src/k8s.io/apiserver/pkg/cel/value.go

    	return o.objectType
    }
    
    // Value returns the Go-native representation of the object.
    func (o *ObjectValue) Value() interface{} {
    	return o
    }
    
    // NewMapValue returns an empty MapValue.
    func NewMapValue() *MapValue {
    	return &MapValue{
    		structValue: newStructValue(),
    	}
    }
    
    // MapValue declares an object with a set of named fields whose values are dynamically typed.
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Oct 10 22:05:55 UTC 2022
    - 20.5K bytes
    - Viewed (0)
  7. staging/src/k8s.io/apiserver/pkg/cel/types.go

    	return &DeclType{
    		name:         "map",
    		KeyType:      key,
    		ElemType:     elem,
    		MaxElements:  maxProperties,
    		celType:      cel.MapType(key.CelType(), elem.CelType()),
    		defaultValue: NewMapValue(),
    		// a map can always be represented as {} in JSON, so hardcode the min size
    		// to 2
    		MinSerializedSize: 2,
    	}
    }
    
    // NewObjectType creates an object type with a qualified name and a set of field declarations.
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon May 08 15:52:31 UTC 2023
    - 18K bytes
    - Viewed (0)
Back to top