Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for IsValueNil (0.16 sec)

  1. operator/pkg/util/reflect_test.go

    func TestIsValueNil(t *testing.T) {
    	if !IsValueNil(nil) {
    		t.Error("got IsValueNil(nil) false, want true")
    	}
    	if !IsValueNil((*int)(nil)) {
    		t.Error("got IsValueNil(ptr) false, want true")
    	}
    	if !IsValueNil(map[int]int(nil)) {
    		t.Error("got IsValueNil(map) false, want true")
    	}
    	if !IsValueNil([]int(nil)) {
    		t.Error("got IsValueNil(slice) false, want true")
    	}
    	if !IsValueNil(any(nil)) {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Jul 25 19:30:47 UTC 2022
    - 10.2K bytes
    - Viewed (0)
  2. operator/pkg/util/reflect.go

    func IsNilOrInvalidValue(v reflect.Value) bool {
    	return !v.IsValid() || (v.Kind() == reflect.Ptr && v.IsNil()) || IsValueNil(v.Interface())
    }
    
    // IsValueNil returns true if either value is nil, or has dynamic type {ptr,
    // map, slice} with value nil.
    func IsValueNil(value any) bool {
    	if value == nil {
    		return true
    	}
    	switch kindOf(value) {
    	case reflect.Slice, reflect.Ptr, reflect.Map:
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Jul 25 19:30:47 UTC 2022
    - 8.6K bytes
    - Viewed (0)
  3. operator/pkg/tpath/struct.go

    	scope.Debugf("getFromStructPath path=%s, node(%T)", path, node)
    	if len(path) == 0 {
    		scope.Debugf("getFromStructPath returning node(%T)%v", node, node)
    		return node, !util.IsValueNil(node), nil
    	}
    	// For protobuf types, switch them out with standard types; otherwise we will traverse protobuf internals rather
    	// than the standard representation
    	if v, ok := node.(*structpb.Struct); ok {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Jul 25 19:30:47 UTC 2022
    - 4.4K bytes
    - Viewed (0)
  4. operator/pkg/validate/validate.go

    }
    
    func validateLeaf(validations map[string]ValidatorFunc, path util.Path, val any, checkRequired bool) util.Errors {
    	pstr := path.String()
    	msg := fmt.Sprintf("validate %s:%v(%T) ", pstr, val, val)
    	if util.IsValueNil(val) || util.IsEmptyString(val) {
    		if checkRequired && requiredValues[pstr] {
    			return util.NewErrs(fmt.Errorf("field %s is required but not set", util.ToYAMLPathString(pstr)))
    		}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Jan 12 16:04:15 UTC 2023
    - 7.7K bytes
    - Viewed (0)
  5. operator/pkg/tpath/tree.go

    func WritePathContext(nc *PathContext, value any, merge bool) error {
    	scope.Debugf("WritePathContext PathContext=%s, value=%v", nc, value)
    
    	if !util.IsValueNil(value) {
    		return setPathContext(nc, value, merge)
    	}
    
    	scope.Debug("delete")
    	if nc.Parent == nil {
    		return errors.New("cannot delete root element")
    	}
    
    	switch {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue May 23 17:08:31 UTC 2023
    - 17.5K bytes
    - Viewed (0)
  6. operator/pkg/translate/translate.go

    func (t *Translator) ProtoToHelmValues(node any, root map[string]any, path util.Path) (errs util.Errors) {
    	scope.Debugf("ProtoToHelmValues with path %s, %v (%T)", path, node, node)
    	if util.IsValueNil(node) {
    		return nil
    	}
    
    	vv := reflect.ValueOf(node)
    	vt := reflect.TypeOf(node)
    	switch vt.Kind() {
    	case reflect.Ptr:
    		if !util.IsNilOrInvalidValue(vv.Elem()) {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Feb 12 19:43:09 UTC 2024
    - 36.3K bytes
    - Viewed (0)
Back to top