Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for MarshalCBOR (0.52 sec)

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

    	if t.IsZero() {
    		// Encode unset/nil objects as JSON's "null".
    		return []byte("null"), nil
    	}
    
    	return json.Marshal(t.UTC().Format(RFC3339Micro))
    }
    
    func (t MicroTime) MarshalCBOR() ([]byte, error) {
    	if t.IsZero() {
    		return cbor.Marshal(nil)
    	}
    	return cbor.Marshal(t.UTC().Format(RFC3339Micro))
    }
    
    // OpenAPISchemaType is used by the kube-openapi generator when constructing
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 29 21:48:10 UTC 2024
    - 5.2K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/time.go

    	buf = append(buf, '"')
    	// time cannot contain non escapable JSON characters
    	buf = t.UTC().AppendFormat(buf, time.RFC3339)
    	buf = append(buf, '"')
    	return buf, nil
    }
    
    func (t Time) MarshalCBOR() ([]byte, error) {
    	if t.IsZero() {
    		return cbor.Marshal(nil)
    	}
    
    	return cbor.Marshal(t.UTC().Format(time.RFC3339))
    }
    
    // ToUnstructured implements the value.UnstructuredConverter interface.
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 29 21:48:09 UTC 2024
    - 5.2K bytes
    - Viewed (0)
  3. staging/src/k8s.io/apimachinery/pkg/util/intstr/intstr.go

    		return json.Marshal(intstr.IntVal)
    	case String:
    		return json.Marshal(intstr.StrVal)
    	default:
    		return []byte{}, fmt.Errorf("impossible IntOrString.Type")
    	}
    }
    
    func (intstr IntOrString) MarshalCBOR() ([]byte, error) {
    	switch intstr.Type {
    	case Int:
    		return cbor.Marshal(intstr.IntVal)
    	case String:
    		return cbor.Marshal(intstr.StrVal)
    	default:
    		return nil, fmt.Errorf("impossible IntOrString.Type")
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 29 21:48:09 UTC 2024
    - 7.8K bytes
    - Viewed (0)
  4. staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_test.go

    	} {
    		t.Run(fmt.Sprintf("%+v", tc.in), func(t *testing.T) {
    			got, err := tc.in.MarshalCBOR()
    			if err != nil {
    				t.Fatal(err)
    			}
    			if diff := cmp.Diff(tc.out, got); diff != "" {
    				t.Errorf("unexpected output:\n%s", diff)
    			}
    		})
    	}
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 29 21:48:10 UTC 2024
    - 11.1K bytes
    - Viewed (0)
  5. staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/time_test.go

    	} {
    		t.Run(fmt.Sprintf("%+v", tc.in), func(t *testing.T) {
    			got, err := tc.in.MarshalCBOR()
    			if err != nil {
    				t.Fatal(err)
    			}
    			if diff := cmp.Diff(tc.out, got); diff != "" {
    				t.Errorf("unexpected output:\n%s", diff)
    			}
    		})
    	}
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 29 21:48:09 UTC 2024
    - 9.4K bytes
    - Viewed (0)
  6. staging/src/k8s.io/apimachinery/pkg/util/intstr/intstr_test.go

    			want: []byte{0x3a, 0x7f, 0xff, 0xff, 0xff},
    		},
    	} {
    		t.Run(fmt.Sprintf("{Type:%d,IntVal:%d,StrVal:%q}", tc.in.Type, tc.in.IntVal, tc.in.StrVal), func(t *testing.T) {
    			got, err := tc.in.MarshalCBOR()
    			if tc.assertOnError != nil {
    				tc.assertOnError(t, err)
    			} else if err != nil {
    				t.Fatalf("unexpected error: %v", err)
    			}
    			if diff := cmp.Diff(got, tc.want); diff != "" {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 29 21:48:09 UTC 2024
    - 14.3K bytes
    - Viewed (0)
  7. staging/src/k8s.io/apimachinery/pkg/runtime/serializer/cbor/cbor_test.go

    }
    
    func (p anyObject) GetObjectKind() schema.ObjectKind {
    	return schema.EmptyObjectKind
    }
    
    func (anyObject) DeepCopyObject() runtime.Object {
    	panic("unimplemented")
    }
    
    func (p anyObject) MarshalCBOR() ([]byte, error) {
    	return modes.Encode.Marshal(p.Value)
    }
    
    func (p *anyObject) UnmarshalCBOR(in []byte) error {
    	return modes.Decode.Unmarshal(in, &p.Value)
    }
    
    func TestEncode(t *testing.T) {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon May 13 14:57:12 UTC 2024
    - 20.1K bytes
    - Viewed (0)
  8. staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go

    	// append
    	result = result[:1]
    	result = append(result, number...)
    	result = append(result, suffix...)
    	result = append(result, '"')
    	return result, nil
    }
    
    func (q Quantity) MarshalCBOR() ([]byte, error) {
    	// The call to String() should never return the string "<nil>" because the receiver's
    	// address will never be nil.
    	return cbor.Marshal(q.String())
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 29 21:48:10 UTC 2024
    - 23.8K bytes
    - Viewed (0)
Back to top