Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for NewObjectVal (0.41 sec)

  1. staging/src/k8s.io/apiserver/pkg/cel/mutation/common/val.go

    // ObjectVal is the CEL Val for an object that is constructed via the object
    // construction syntax.
    type ObjectVal struct {
    	typeRef TypeRef
    	fields  map[string]ref.Val
    }
    
    // NewObjectVal creates an ObjectVal by its TypeRef and its fields.
    func NewObjectVal(typeRef TypeRef, fields map[string]ref.Val) *ObjectVal {
    	return &ObjectVal{
    		typeRef: typeRef,
    		fields:  fields,
    	}
    }
    
    var _ ref.Val = (*ObjectVal)(nil)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Feb 27 21:55:08 UTC 2024
    - 4.2K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apiserver/pkg/cel/mutation/optional_test.go

    				?existing: optional.none()
    			}`,
    			expectedVal: common.NewObjectVal(nil, map[string]ref.Val{
    				// "existing" field was not set.
    			}),
    		},
    		{
    			name:        "object of zero value, ofNonZeroValue",
    			expression:  `Object{?spec: optional.ofNonZeroValue(Object.spec{?replicas: Object{}.?replicas})}`,
    			expectedVal: common.NewObjectVal(nil, map[string]ref.Val{
    				// "existing" field was not set.
    			}),
    		},
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Jan 25 21:52:39 UTC 2024
    - 4.9K bytes
    - Viewed (0)
  3. staging/src/k8s.io/apiserver/pkg/cel/mutation/mock_test.go

    			return true
    		},
    		GetFrom: func(target any) (any, error) {
    			return nil, nil
    		},
    	}, true
    }
    
    func (m *mockTypeRef) Val(fields map[string]ref.Val) ref.Val {
    	return common.NewObjectVal(m, fields)
    }
    
    func (m *mockTypeResolver) Resolve(name string) (common.TypeRef, bool) {
    	if strings.HasPrefix(name, common.RootTypeReferenceName) {
    		return newMockTypeRef(m, name), true
    	}
    	return nil, false
    }
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jan 24 00:01:35 UTC 2024
    - 2.9K bytes
    - Viewed (0)
  4. staging/src/k8s.io/apiserver/pkg/cel/mutation/unstructured/typeref.go

    func (r *TypeRef) TypeName() string {
    	return r.celObjectType.TypeName()
    }
    
    // Val returns an instance given the fields.
    func (r *TypeRef) Val(fields map[string]ref.Val) ref.Val {
    	return common.NewObjectVal(r, fields)
    }
    
    // CELType returns the type. The returned type is of TypeType type.
    func (r *TypeRef) CELType() *types.Type {
    	return r.celTypeType
    }
    
    // Field looks up the field by name.
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jan 24 00:01:35 UTC 2024
    - 1.9K bytes
    - Viewed (0)
Back to top