Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for RawMessage (0.15 sec)

  1. src/encoding/json/encode_test.go

    }
    
    func TestMarshalRawMessageValue(t *testing.T) {
    	type (
    		T1 struct {
    			M RawMessage `json:",omitempty"`
    		}
    		T2 struct {
    			M *RawMessage `json:",omitempty"`
    		}
    	)
    
    	var (
    		rawNil   = RawMessage(nil)
    		rawEmpty = RawMessage([]byte{})
    		rawText  = RawMessage([]byte(`"foo"`))
    	)
    
    	tests := []struct {
    		CaseName
    		in   any
    		want string
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 18:42:28 UTC 2024
    - 29.4K bytes
    - Viewed (0)
  2. src/encoding/json/stream.go

    }
    
    // UnmarshalJSON sets *m to a copy of data.
    func (m *RawMessage) UnmarshalJSON(data []byte) error {
    	if m == nil {
    		return errors.New("json.RawMessage: UnmarshalJSON on nil pointer")
    	}
    	*m = append((*m)[0:0], data...)
    	return nil
    }
    
    var _ Marshaler = (*RawMessage)(nil)
    var _ Unmarshaler = (*RawMessage)(nil)
    
    // A Token holds a value of one of these types:
    //
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 08 19:04:28 UTC 2023
    - 12.9K bytes
    - Viewed (0)
  3. src/encoding/json/stream_test.go

    	}
    	if string(got) != want {
    		t.Fatalf("Marshal:\n\tgot:  %s\n\twant: %s", got, want)
    	}
    }
    
    func TestNullRawMessage(t *testing.T) {
    	var data struct {
    		X     float64
    		Id    RawMessage
    		IdPtr *RawMessage
    		Y     float32
    	}
    	const want = `{"X":0.1,"Id":null,"IdPtr":null,"Y":0.2}`
    	err := Unmarshal([]byte(want), &data)
    	if err != nil {
    		t.Fatalf("Unmarshal error: %v", err)
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Aug 25 16:00:37 UTC 2023
    - 12.9K bytes
    - Viewed (0)
  4. staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go

    	return unstructuredJSONSchemeIdentifier
    }
    
    func (s unstructuredJSONScheme) decode(data []byte) (runtime.Object, error) {
    	type detector struct {
    		Items gojson.RawMessage `json:"items"`
    	}
    	var det detector
    	if err := json.Unmarshal(data, &det); err != nil {
    		return nil, err
    	}
    
    	if det.Items != nil {
    		list := &UnstructuredList{}
    		err := s.decodeToList(data, list)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Jun 29 20:39:55 UTC 2023
    - 16.3K bytes
    - Viewed (0)
  5. src/log/slog/handler_test.go

    			wantText: `msg=message bs="\x01\x02\x03\x04"`,
    			wantJSON: `{"msg":"message","bs":"AQIDBA=="}`,
    		},
    		{
    			name:     "json.RawMessage",
    			replace:  removeKeys(TimeKey, LevelKey),
    			attrs:    []Attr{Any("bs", json.RawMessage([]byte("1234")))},
    			wantText: `msg=message bs="1234"`,
    			wantJSON: `{"msg":"message","bs":1234}`,
    		},
    		{
    			name:    "inline group",
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 02 13:57:53 UTC 2023
    - 19.6K bytes
    - Viewed (0)
  6. src/encoding/json/bench_test.go

    				for pb.Next() {
    					cachedTypeFields(types[0])
    				}
    			})
    		})
    	}
    }
    
    func BenchmarkEncodeMarshaler(b *testing.B) {
    	b.ReportAllocs()
    
    	m := struct {
    		A int
    		B RawMessage
    	}{}
    
    	b.RunParallel(func(pb *testing.PB) {
    		enc := NewEncoder(io.Discard)
    
    		for pb.Next() {
    			if err := enc.Encode(&m); err != nil {
    				b.Fatalf("Encode error: %v", err)
    			}
    		}
    	})
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 15:00:17 UTC 2024
    - 12.5K bytes
    - Viewed (0)
  7. pkg/config/model.go

    	// Unmarshal from json bytes to go map
    	var data map[string]any
    	err = json.Unmarshal(js, &data)
    	if err != nil {
    		return nil, err
    	}
    
    	return data, nil
    }
    
    func ToRaw(s Spec) (json.RawMessage, error) {
    	js, err := ToJSON(s)
    	if err != nil {
    		return nil, err
    	}
    
    	// Unmarshal from json bytes to go map
    	return js, nil
    }
    
    func ToJSON(s Spec) ([]byte, error) {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed May 29 15:31:09 UTC 2024
    - 12.6K bytes
    - Viewed (0)
  8. api/go1.8.txt

    pkg debug/pe, type Section struct, Relocs []Reloc
    pkg debug/pe, type StringTable []uint8
    pkg encoding/base64, method (Encoding) Strict() *Encoding
    pkg encoding/json, method (RawMessage) MarshalJSON() ([]uint8, error)
    pkg encoding/json, type UnmarshalTypeError struct, Field string
    pkg encoding/json, type UnmarshalTypeError struct, Struct string
    pkg expvar, func Handler() http.Handler
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Dec 21 05:25:57 UTC 2016
    - 16.3K bytes
    - Viewed (0)
  9. staging/src/k8s.io/apiserver/plugin/pkg/authenticator/token/oidc/oidc.go

    	// CEL expressions.
    	// TODO(aramase): In the future when we look into making distributed claims work,
    	// we should see if we can skip this function and use a dynamic type resolver for
    	// both json.RawMessage and the distributed claim fetching.
    	if a.celMapper.Username != nil || a.celMapper.Groups != nil || a.celMapper.UID != nil || a.celMapper.Extra != nil || a.celMapper.ClaimValidationRules != nil {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat Mar 09 19:29:33 UTC 2024
    - 37.9K bytes
    - Viewed (0)
  10. docs/debugging/xl-meta/main.go

    					b = nbuf
    				}
    
    				hdr, v, err := decodeXLHeaders(v)
    				if err != nil {
    					return nil, err
    				}
    				type version struct {
    					Idx      int
    					Header   json.RawMessage
    					Metadata json.RawMessage
    				}
    				versions := make([]version, hdr.versions)
    				headerVer := hdr.headerVer
    				err = decodeVersions(v, hdr.versions, func(idx int, hdr, meta []byte) error {
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Fri May 31 14:49:23 UTC 2024
    - 38.5K bytes
    - Viewed (0)
Back to top