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

Method Marshal

pkg/sql/types/types.go:1777–1785  ·  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

1775// bytes, err := protoutil.Marshal(&typ)
1776//
1777func (t *T) Marshal() (data []byte, err error) {
1778 // First downgrade to a struct that will be serialized in a backwards-
1779 // compatible bytes format.
1780 temp := *t
1781 if err := temp.downgradeType(); err != nil {
1782 return nil, err
1783 }
1784 return protoutil.Marshal(&temp.InternalType)
1785}
1786
1787// MarshalTo behaves like Marshal, except that it deserializes to an existing
1788// byte slice and returns the number of bytes written to it. The slice must

Callers

nothing calls this directly

Calls 2

MarshalFunction · 0.92
downgradeTypeMethod · 0.80

Tested by

no test coverage detected