···
cw := cbg.NewCborWriter(w)
1213
-
if _, err := cw.Write([]byte{162}); err != nil {
1214
+
if t.LangBreakdown == nil {
1218
+
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
···
if err := cbg.WriteBool(w, t.IsDefaultRef); err != nil {
1254
+
// t.LangBreakdown (tangled.GitRefUpdate_Meta_LangBreakdown) (struct)
1255
+
if t.LangBreakdown != nil {
1257
+
if len("langBreakdown") > 1000000 {
1258
+
return xerrors.Errorf("Value in field \"langBreakdown\" was too long")
1261
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("langBreakdown"))); err != nil {
1264
+
if _, err := cw.WriteString(string("langBreakdown")); err != nil {
1268
+
if err := t.LangBreakdown.MarshalCBOR(cw); err != nil {
···
1276
-
nameBuf := make([]byte, 12)
1300
+
nameBuf := make([]byte, 13)
for i := uint64(0); i < n; i++ {
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
···
return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra)
1354
+
// t.LangBreakdown (tangled.GitRefUpdate_Meta_LangBreakdown) (struct)
1355
+
case "langBreakdown":
1359
+
b, err := cr.ReadByte()
1363
+
if b != cbg.CborNull[0] {
1364
+
if err := cr.UnreadByte(); err != nil {
1367
+
t.LangBreakdown = new(GitRefUpdate_Meta_LangBreakdown)
1368
+
if err := t.LangBreakdown.UnmarshalCBOR(cr); err != nil {
1369
+
return xerrors.Errorf("unmarshaling t.LangBreakdown pointer: %w", err)
// Field doesn't exist on this type, so ignore it
···
1682
+
func (t *GitRefUpdate_Meta_LangBreakdown) MarshalCBOR(w io.Writer) error {
1684
+
_, err := w.Write(cbg.CborNull)
1688
+
cw := cbg.NewCborWriter(w)
1691
+
if t.Inputs == nil {
1695
+
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
1699
+
// t.Inputs ([]*tangled.GitRefUpdate_Pair) (slice)
1700
+
if t.Inputs != nil {
1702
+
if len("inputs") > 1000000 {
1703
+
return xerrors.Errorf("Value in field \"inputs\" was too long")
1706
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("inputs"))); err != nil {
1709
+
if _, err := cw.WriteString(string("inputs")); err != nil {
1713
+
if len(t.Inputs) > 8192 {
1714
+
return xerrors.Errorf("Slice value in field t.Inputs was too long")
1717
+
if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Inputs))); err != nil {
1720
+
for _, v := range t.Inputs {
1721
+
if err := v.MarshalCBOR(cw); err != nil {
1730
+
func (t *GitRefUpdate_Meta_LangBreakdown) UnmarshalCBOR(r io.Reader) (err error) {
1731
+
*t = GitRefUpdate_Meta_LangBreakdown{}
1733
+
cr := cbg.NewCborReader(r)
1735
+
maj, extra, err := cr.ReadHeader()
1740
+
if err == io.EOF {
1741
+
err = io.ErrUnexpectedEOF
1745
+
if maj != cbg.MajMap {
1746
+
return fmt.Errorf("cbor input should be of type map")
1749
+
if extra > cbg.MaxLength {
1750
+
return fmt.Errorf("GitRefUpdate_Meta_LangBreakdown: map struct too large (%d)", extra)
1755
+
nameBuf := make([]byte, 6)
1756
+
for i := uint64(0); i < n; i++ {
1757
+
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
1763
+
// Field doesn't exist on this type, so ignore it
1764
+
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
1770
+
switch string(nameBuf[:nameLen]) {
1771
+
// t.Inputs ([]*tangled.GitRefUpdate_Pair) (slice)
1774
+
maj, extra, err = cr.ReadHeader()
1780
+
return fmt.Errorf("t.Inputs: array too large (%d)", extra)
1783
+
if maj != cbg.MajArray {
1784
+
return fmt.Errorf("expected cbor array")
1788
+
t.Inputs = make([]*GitRefUpdate_Pair, extra)
1791
+
for i := 0; i < int(extra); i++ {
1802
+
b, err := cr.ReadByte()
1806
+
if b != cbg.CborNull[0] {
1807
+
if err := cr.UnreadByte(); err != nil {
1810
+
t.Inputs[i] = new(GitRefUpdate_Pair)
1811
+
if err := t.Inputs[i].UnmarshalCBOR(cr); err != nil {
1812
+
return xerrors.Errorf("unmarshaling t.Inputs[i] pointer: %w", err)
1822
+
// Field doesn't exist on this type, so ignore it
1823
+
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
1831
+
func (t *GitRefUpdate_Pair) MarshalCBOR(w io.Writer) error {
1833
+
_, err := w.Write(cbg.CborNull)
1837
+
cw := cbg.NewCborWriter(w)
1839
+
if _, err := cw.Write([]byte{162}); err != nil {
1843
+
// t.Lang (string) (string)
1844
+
if len("lang") > 1000000 {
1845
+
return xerrors.Errorf("Value in field \"lang\" was too long")
1848
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("lang"))); err != nil {
1851
+
if _, err := cw.WriteString(string("lang")); err != nil {
1855
+
if len(t.Lang) > 1000000 {
1856
+
return xerrors.Errorf("Value in field t.Lang was too long")
1859
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Lang))); err != nil {
1862
+
if _, err := cw.WriteString(string(t.Lang)); err != nil {
1866
+
// t.Size (int64) (int64)
1867
+
if len("size") > 1000000 {
1868
+
return xerrors.Errorf("Value in field \"size\" was too long")
1871
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("size"))); err != nil {
1874
+
if _, err := cw.WriteString(string("size")); err != nil {
1879
+
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Size)); err != nil {
1883
+
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Size-1)); err != nil {
1891
+
func (t *GitRefUpdate_Pair) UnmarshalCBOR(r io.Reader) (err error) {
1892
+
*t = GitRefUpdate_Pair{}
1894
+
cr := cbg.NewCborReader(r)
1896
+
maj, extra, err := cr.ReadHeader()
1901
+
if err == io.EOF {
1902
+
err = io.ErrUnexpectedEOF
1906
+
if maj != cbg.MajMap {
1907
+
return fmt.Errorf("cbor input should be of type map")
1910
+
if extra > cbg.MaxLength {
1911
+
return fmt.Errorf("GitRefUpdate_Pair: map struct too large (%d)", extra)
1916
+
nameBuf := make([]byte, 4)
1917
+
for i := uint64(0); i < n; i++ {
1918
+
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
1924
+
// Field doesn't exist on this type, so ignore it
1925
+
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
1931
+
switch string(nameBuf[:nameLen]) {
1932
+
// t.Lang (string) (string)
1936
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
1941
+
t.Lang = string(sval)
1943
+
// t.Size (int64) (int64)
1946
+
maj, extra, err := cr.ReadHeader()
1952
+
case cbg.MajUnsignedInt:
1953
+
extraI = int64(extra)
1955
+
return fmt.Errorf("int64 positive overflow")
1957
+
case cbg.MajNegativeInt:
1958
+
extraI = int64(extra)
1960
+
return fmt.Errorf("int64 negative overflow")
1962
+
extraI = -1 - extraI
1964
+
return fmt.Errorf("wrong type for int64 field: %d", maj)
1967
+
t.Size = int64(extraI)
1971
+
// Field doesn't exist on this type, so ignore it
1972
+
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
func (t *GraphFollow) MarshalCBOR(w io.Writer) error {
_, err := w.Write(cbg.CborNull)