MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / Marshal

Method Marshal

pkg/sql/types/types.go:2655–2663  ·  view source on GitHub ↗

Marshal serializes a type into a byte representation using gogo protobuf serialization rules. It returns the resulting bytes as a slice. The bytes are serialized in a format that is backwards-compatible with the previous version of CRDB so that clusters can run in mixed version mode during upgrade.

()

Source from the content-addressed store, hash-verified

2653//
2654// bytes, err := protoutil.Marshal(&typ)
2655func (t *T) Marshal() (data []byte, err error) {
2656 // First downgrade to a struct that will be serialized in a backwards-
2657 // compatible bytes format.
2658 temp := *t
2659 if err := temp.downgradeType(); err != nil {
2660 return nil, err
2661 }
2662 return protoutil.Marshal(&temp.InternalType)
2663}
2664
2665// MarshalToSizedBuffer is like Mashal, except that it deserializes to
2666// an existing byte slice with exactly enough remaining space for

Callers 1

MarshalJSONPBMethod · 0.45

Calls 2

MarshalFunction · 0.92
downgradeTypeMethod · 0.80

Tested by

no test coverage detected