this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

api: remove manual api.PostRecord

Also removes CBOR generation code for these types.

The only remaining use was in carstore tests.

+7 -855
-30
api/bsky.go
··· 1 - package api 2 - 3 - type PostEntity struct { 4 - Index *TextSlice `json:"index" cborgen:"index"` 5 - Type string `json:"type" cborgen:"type"` 6 - Value string `json:"value" cborgen:"value"` 7 - } 8 - 9 - type TextSlice struct { 10 - Start int64 `json:"start" cborgen:"start"` 11 - End int64 `json:"end" cborgen:"end"` 12 - } 13 - 14 - type ReplyRef struct { 15 - Root PostRef `json:"root" cborgen:"root"` 16 - Parent PostRef `json:"parent" cborgen:"parent"` 17 - } 18 - 19 - type PostRecord struct { 20 - Type string `json:"$type,omitempty" cborgen:"$type"` 21 - Text string `json:"text" cborgen:"text"` 22 - Entities []*PostEntity `json:"entities,omitempty" cborgen:"entities"` 23 - Reply *ReplyRef `json:"reply,omitempty" cborgen:"reply"` 24 - CreatedAt string `json:"createdAt" cborgen:"createdAt"` 25 - } 26 - 27 - type PostRef struct { 28 - Uri string `json:"uri"` 29 - Cid string `json:"cid"` 30 - }
-818
api/cbor_gen.go
··· 18 18 var _ = math.E 19 19 var _ = sort.Sort 20 20 21 - func (t *PostRecord) MarshalCBOR(w io.Writer) error { 22 - if t == nil { 23 - _, err := w.Write(cbg.CborNull) 24 - return err 25 - } 26 - 27 - cw := cbg.NewCborWriter(w) 28 - 29 - if _, err := cw.Write([]byte{165}); err != nil { 30 - return err 31 - } 32 - 33 - // t.Text (string) (string) 34 - if len("text") > cbg.MaxLength { 35 - return xerrors.Errorf("Value in field \"text\" was too long") 36 - } 37 - 38 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("text"))); err != nil { 39 - return err 40 - } 41 - if _, err := io.WriteString(w, string("text")); err != nil { 42 - return err 43 - } 44 - 45 - if len(t.Text) > cbg.MaxLength { 46 - return xerrors.Errorf("Value in field t.Text was too long") 47 - } 48 - 49 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Text))); err != nil { 50 - return err 51 - } 52 - if _, err := io.WriteString(w, string(t.Text)); err != nil { 53 - return err 54 - } 55 - 56 - // t.Type (string) (string) 57 - if len("$type") > cbg.MaxLength { 58 - return xerrors.Errorf("Value in field \"$type\" was too long") 59 - } 60 - 61 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 62 - return err 63 - } 64 - if _, err := io.WriteString(w, string("$type")); err != nil { 65 - return err 66 - } 67 - 68 - if len(t.Type) > cbg.MaxLength { 69 - return xerrors.Errorf("Value in field t.Type was too long") 70 - } 71 - 72 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Type))); err != nil { 73 - return err 74 - } 75 - if _, err := io.WriteString(w, string(t.Type)); err != nil { 76 - return err 77 - } 78 - 79 - // t.Reply (api.ReplyRef) (struct) 80 - if len("reply") > cbg.MaxLength { 81 - return xerrors.Errorf("Value in field \"reply\" was too long") 82 - } 83 - 84 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("reply"))); err != nil { 85 - return err 86 - } 87 - if _, err := io.WriteString(w, string("reply")); err != nil { 88 - return err 89 - } 90 - 91 - if err := t.Reply.MarshalCBOR(cw); err != nil { 92 - return err 93 - } 94 - 95 - // t.Entities ([]*api.PostEntity) (slice) 96 - if len("entities") > cbg.MaxLength { 97 - return xerrors.Errorf("Value in field \"entities\" was too long") 98 - } 99 - 100 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("entities"))); err != nil { 101 - return err 102 - } 103 - if _, err := io.WriteString(w, string("entities")); err != nil { 104 - return err 105 - } 106 - 107 - if len(t.Entities) > cbg.MaxLength { 108 - return xerrors.Errorf("Slice value in field t.Entities was too long") 109 - } 110 - 111 - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Entities))); err != nil { 112 - return err 113 - } 114 - for _, v := range t.Entities { 115 - if err := v.MarshalCBOR(cw); err != nil { 116 - return err 117 - } 118 - } 119 - 120 - // t.CreatedAt (string) (string) 121 - if len("createdAt") > cbg.MaxLength { 122 - return xerrors.Errorf("Value in field \"createdAt\" was too long") 123 - } 124 - 125 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { 126 - return err 127 - } 128 - if _, err := io.WriteString(w, string("createdAt")); err != nil { 129 - return err 130 - } 131 - 132 - if len(t.CreatedAt) > cbg.MaxLength { 133 - return xerrors.Errorf("Value in field t.CreatedAt was too long") 134 - } 135 - 136 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { 137 - return err 138 - } 139 - if _, err := io.WriteString(w, string(t.CreatedAt)); err != nil { 140 - return err 141 - } 142 - return nil 143 - } 144 - 145 - func (t *PostRecord) UnmarshalCBOR(r io.Reader) (err error) { 146 - *t = PostRecord{} 147 - 148 - cr := cbg.NewCborReader(r) 149 - 150 - maj, extra, err := cr.ReadHeader() 151 - if err != nil { 152 - return err 153 - } 154 - defer func() { 155 - if err == io.EOF { 156 - err = io.ErrUnexpectedEOF 157 - } 158 - }() 159 - 160 - if maj != cbg.MajMap { 161 - return fmt.Errorf("cbor input should be of type map") 162 - } 163 - 164 - if extra > cbg.MaxLength { 165 - return fmt.Errorf("PostRecord: map struct too large (%d)", extra) 166 - } 167 - 168 - var name string 169 - n := extra 170 - 171 - for i := uint64(0); i < n; i++ { 172 - 173 - { 174 - sval, err := cbg.ReadString(cr) 175 - if err != nil { 176 - return err 177 - } 178 - 179 - name = string(sval) 180 - } 181 - 182 - switch name { 183 - // t.Text (string) (string) 184 - case "text": 185 - 186 - { 187 - sval, err := cbg.ReadString(cr) 188 - if err != nil { 189 - return err 190 - } 191 - 192 - t.Text = string(sval) 193 - } 194 - // t.Type (string) (string) 195 - case "$type": 196 - 197 - { 198 - sval, err := cbg.ReadString(cr) 199 - if err != nil { 200 - return err 201 - } 202 - 203 - t.Type = string(sval) 204 - } 205 - // t.Reply (api.ReplyRef) (struct) 206 - case "reply": 207 - 208 - { 209 - 210 - b, err := cr.ReadByte() 211 - if err != nil { 212 - return err 213 - } 214 - if b != cbg.CborNull[0] { 215 - if err := cr.UnreadByte(); err != nil { 216 - return err 217 - } 218 - t.Reply = new(ReplyRef) 219 - if err := t.Reply.UnmarshalCBOR(cr); err != nil { 220 - return xerrors.Errorf("unmarshaling t.Reply pointer: %w", err) 221 - } 222 - } 223 - 224 - } 225 - // t.Entities ([]*api.PostEntity) (slice) 226 - case "entities": 227 - 228 - maj, extra, err = cr.ReadHeader() 229 - if err != nil { 230 - return err 231 - } 232 - 233 - if extra > cbg.MaxLength { 234 - return fmt.Errorf("t.Entities: array too large (%d)", extra) 235 - } 236 - 237 - if maj != cbg.MajArray { 238 - return fmt.Errorf("expected cbor array") 239 - } 240 - 241 - if extra > 0 { 242 - t.Entities = make([]*PostEntity, extra) 243 - } 244 - 245 - for i := 0; i < int(extra); i++ { 246 - 247 - var v PostEntity 248 - if err := v.UnmarshalCBOR(cr); err != nil { 249 - return err 250 - } 251 - 252 - t.Entities[i] = &v 253 - } 254 - 255 - // t.CreatedAt (string) (string) 256 - case "createdAt": 257 - 258 - { 259 - sval, err := cbg.ReadString(cr) 260 - if err != nil { 261 - return err 262 - } 263 - 264 - t.CreatedAt = string(sval) 265 - } 266 - 267 - default: 268 - // Field doesn't exist on this type, so ignore it 269 - cbg.ScanForLinks(r, func(cid.Cid) {}) 270 - } 271 - } 272 - 273 - return nil 274 - } 275 - func (t *PostEntity) MarshalCBOR(w io.Writer) error { 276 - if t == nil { 277 - _, err := w.Write(cbg.CborNull) 278 - return err 279 - } 280 - 281 - cw := cbg.NewCborWriter(w) 282 - 283 - if _, err := cw.Write([]byte{163}); err != nil { 284 - return err 285 - } 286 - 287 - // t.Type (string) (string) 288 - if len("type") > cbg.MaxLength { 289 - return xerrors.Errorf("Value in field \"type\" was too long") 290 - } 291 - 292 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("type"))); err != nil { 293 - return err 294 - } 295 - if _, err := io.WriteString(w, string("type")); err != nil { 296 - return err 297 - } 298 - 299 - if len(t.Type) > cbg.MaxLength { 300 - return xerrors.Errorf("Value in field t.Type was too long") 301 - } 302 - 303 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Type))); err != nil { 304 - return err 305 - } 306 - if _, err := io.WriteString(w, string(t.Type)); err != nil { 307 - return err 308 - } 309 - 310 - // t.Index (api.TextSlice) (struct) 311 - if len("index") > cbg.MaxLength { 312 - return xerrors.Errorf("Value in field \"index\" was too long") 313 - } 314 - 315 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("index"))); err != nil { 316 - return err 317 - } 318 - if _, err := io.WriteString(w, string("index")); err != nil { 319 - return err 320 - } 321 - 322 - if err := t.Index.MarshalCBOR(cw); err != nil { 323 - return err 324 - } 325 - 326 - // t.Value (string) (string) 327 - if len("value") > cbg.MaxLength { 328 - return xerrors.Errorf("Value in field \"value\" was too long") 329 - } 330 - 331 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("value"))); err != nil { 332 - return err 333 - } 334 - if _, err := io.WriteString(w, string("value")); err != nil { 335 - return err 336 - } 337 - 338 - if len(t.Value) > cbg.MaxLength { 339 - return xerrors.Errorf("Value in field t.Value was too long") 340 - } 341 - 342 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Value))); err != nil { 343 - return err 344 - } 345 - if _, err := io.WriteString(w, string(t.Value)); err != nil { 346 - return err 347 - } 348 - return nil 349 - } 350 - 351 - func (t *PostEntity) UnmarshalCBOR(r io.Reader) (err error) { 352 - *t = PostEntity{} 353 - 354 - cr := cbg.NewCborReader(r) 355 - 356 - maj, extra, err := cr.ReadHeader() 357 - if err != nil { 358 - return err 359 - } 360 - defer func() { 361 - if err == io.EOF { 362 - err = io.ErrUnexpectedEOF 363 - } 364 - }() 365 - 366 - if maj != cbg.MajMap { 367 - return fmt.Errorf("cbor input should be of type map") 368 - } 369 - 370 - if extra > cbg.MaxLength { 371 - return fmt.Errorf("PostEntity: map struct too large (%d)", extra) 372 - } 373 - 374 - var name string 375 - n := extra 376 - 377 - for i := uint64(0); i < n; i++ { 378 - 379 - { 380 - sval, err := cbg.ReadString(cr) 381 - if err != nil { 382 - return err 383 - } 384 - 385 - name = string(sval) 386 - } 387 - 388 - switch name { 389 - // t.Type (string) (string) 390 - case "type": 391 - 392 - { 393 - sval, err := cbg.ReadString(cr) 394 - if err != nil { 395 - return err 396 - } 397 - 398 - t.Type = string(sval) 399 - } 400 - // t.Index (api.TextSlice) (struct) 401 - case "index": 402 - 403 - { 404 - 405 - b, err := cr.ReadByte() 406 - if err != nil { 407 - return err 408 - } 409 - if b != cbg.CborNull[0] { 410 - if err := cr.UnreadByte(); err != nil { 411 - return err 412 - } 413 - t.Index = new(TextSlice) 414 - if err := t.Index.UnmarshalCBOR(cr); err != nil { 415 - return xerrors.Errorf("unmarshaling t.Index pointer: %w", err) 416 - } 417 - } 418 - 419 - } 420 - // t.Value (string) (string) 421 - case "value": 422 - 423 - { 424 - sval, err := cbg.ReadString(cr) 425 - if err != nil { 426 - return err 427 - } 428 - 429 - t.Value = string(sval) 430 - } 431 - 432 - default: 433 - // Field doesn't exist on this type, so ignore it 434 - cbg.ScanForLinks(r, func(cid.Cid) {}) 435 - } 436 - } 437 - 438 - return nil 439 - } 440 - func (t *PostRef) MarshalCBOR(w io.Writer) error { 441 - if t == nil { 442 - _, err := w.Write(cbg.CborNull) 443 - return err 444 - } 445 - 446 - cw := cbg.NewCborWriter(w) 447 - 448 - if _, err := cw.Write([]byte{162}); err != nil { 449 - return err 450 - } 451 - 452 - // t.Cid (string) (string) 453 - if len("Cid") > cbg.MaxLength { 454 - return xerrors.Errorf("Value in field \"Cid\" was too long") 455 - } 456 - 457 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Cid"))); err != nil { 458 - return err 459 - } 460 - if _, err := io.WriteString(w, string("Cid")); err != nil { 461 - return err 462 - } 463 - 464 - if len(t.Cid) > cbg.MaxLength { 465 - return xerrors.Errorf("Value in field t.Cid was too long") 466 - } 467 - 468 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Cid))); err != nil { 469 - return err 470 - } 471 - if _, err := io.WriteString(w, string(t.Cid)); err != nil { 472 - return err 473 - } 474 - 475 - // t.Uri (string) (string) 476 - if len("Uri") > cbg.MaxLength { 477 - return xerrors.Errorf("Value in field \"Uri\" was too long") 478 - } 479 - 480 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Uri"))); err != nil { 481 - return err 482 - } 483 - if _, err := io.WriteString(w, string("Uri")); err != nil { 484 - return err 485 - } 486 - 487 - if len(t.Uri) > cbg.MaxLength { 488 - return xerrors.Errorf("Value in field t.Uri was too long") 489 - } 490 - 491 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Uri))); err != nil { 492 - return err 493 - } 494 - if _, err := io.WriteString(w, string(t.Uri)); err != nil { 495 - return err 496 - } 497 - return nil 498 - } 499 - 500 - func (t *PostRef) UnmarshalCBOR(r io.Reader) (err error) { 501 - *t = PostRef{} 502 - 503 - cr := cbg.NewCborReader(r) 504 - 505 - maj, extra, err := cr.ReadHeader() 506 - if err != nil { 507 - return err 508 - } 509 - defer func() { 510 - if err == io.EOF { 511 - err = io.ErrUnexpectedEOF 512 - } 513 - }() 514 - 515 - if maj != cbg.MajMap { 516 - return fmt.Errorf("cbor input should be of type map") 517 - } 518 - 519 - if extra > cbg.MaxLength { 520 - return fmt.Errorf("PostRef: map struct too large (%d)", extra) 521 - } 522 - 523 - var name string 524 - n := extra 525 - 526 - for i := uint64(0); i < n; i++ { 527 - 528 - { 529 - sval, err := cbg.ReadString(cr) 530 - if err != nil { 531 - return err 532 - } 533 - 534 - name = string(sval) 535 - } 536 - 537 - switch name { 538 - // t.Cid (string) (string) 539 - case "Cid": 540 - 541 - { 542 - sval, err := cbg.ReadString(cr) 543 - if err != nil { 544 - return err 545 - } 546 - 547 - t.Cid = string(sval) 548 - } 549 - // t.Uri (string) (string) 550 - case "Uri": 551 - 552 - { 553 - sval, err := cbg.ReadString(cr) 554 - if err != nil { 555 - return err 556 - } 557 - 558 - t.Uri = string(sval) 559 - } 560 - 561 - default: 562 - // Field doesn't exist on this type, so ignore it 563 - cbg.ScanForLinks(r, func(cid.Cid) {}) 564 - } 565 - } 566 - 567 - return nil 568 - } 569 - func (t *ReplyRef) MarshalCBOR(w io.Writer) error { 570 - if t == nil { 571 - _, err := w.Write(cbg.CborNull) 572 - return err 573 - } 574 - 575 - cw := cbg.NewCborWriter(w) 576 - 577 - if _, err := cw.Write([]byte{162}); err != nil { 578 - return err 579 - } 580 - 581 - // t.Root (api.PostRef) (struct) 582 - if len("root") > cbg.MaxLength { 583 - return xerrors.Errorf("Value in field \"root\" was too long") 584 - } 585 - 586 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("root"))); err != nil { 587 - return err 588 - } 589 - if _, err := io.WriteString(w, string("root")); err != nil { 590 - return err 591 - } 592 - 593 - if err := t.Root.MarshalCBOR(cw); err != nil { 594 - return err 595 - } 596 - 597 - // t.Parent (api.PostRef) (struct) 598 - if len("parent") > cbg.MaxLength { 599 - return xerrors.Errorf("Value in field \"parent\" was too long") 600 - } 601 - 602 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("parent"))); err != nil { 603 - return err 604 - } 605 - if _, err := io.WriteString(w, string("parent")); err != nil { 606 - return err 607 - } 608 - 609 - if err := t.Parent.MarshalCBOR(cw); err != nil { 610 - return err 611 - } 612 - return nil 613 - } 614 - 615 - func (t *ReplyRef) UnmarshalCBOR(r io.Reader) (err error) { 616 - *t = ReplyRef{} 617 - 618 - cr := cbg.NewCborReader(r) 619 - 620 - maj, extra, err := cr.ReadHeader() 621 - if err != nil { 622 - return err 623 - } 624 - defer func() { 625 - if err == io.EOF { 626 - err = io.ErrUnexpectedEOF 627 - } 628 - }() 629 - 630 - if maj != cbg.MajMap { 631 - return fmt.Errorf("cbor input should be of type map") 632 - } 633 - 634 - if extra > cbg.MaxLength { 635 - return fmt.Errorf("ReplyRef: map struct too large (%d)", extra) 636 - } 637 - 638 - var name string 639 - n := extra 640 - 641 - for i := uint64(0); i < n; i++ { 642 - 643 - { 644 - sval, err := cbg.ReadString(cr) 645 - if err != nil { 646 - return err 647 - } 648 - 649 - name = string(sval) 650 - } 651 - 652 - switch name { 653 - // t.Root (api.PostRef) (struct) 654 - case "root": 655 - 656 - { 657 - 658 - if err := t.Root.UnmarshalCBOR(cr); err != nil { 659 - return xerrors.Errorf("unmarshaling t.Root: %w", err) 660 - } 661 - 662 - } 663 - // t.Parent (api.PostRef) (struct) 664 - case "parent": 665 - 666 - { 667 - 668 - if err := t.Parent.UnmarshalCBOR(cr); err != nil { 669 - return xerrors.Errorf("unmarshaling t.Parent: %w", err) 670 - } 671 - 672 - } 673 - 674 - default: 675 - // Field doesn't exist on this type, so ignore it 676 - cbg.ScanForLinks(r, func(cid.Cid) {}) 677 - } 678 - } 679 - 680 - return nil 681 - } 682 - func (t *TextSlice) MarshalCBOR(w io.Writer) error { 683 - if t == nil { 684 - _, err := w.Write(cbg.CborNull) 685 - return err 686 - } 687 - 688 - cw := cbg.NewCborWriter(w) 689 - 690 - if _, err := cw.Write([]byte{162}); err != nil { 691 - return err 692 - } 693 - 694 - // t.End (int64) (int64) 695 - if len("end") > cbg.MaxLength { 696 - return xerrors.Errorf("Value in field \"end\" was too long") 697 - } 698 - 699 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("end"))); err != nil { 700 - return err 701 - } 702 - if _, err := io.WriteString(w, string("end")); err != nil { 703 - return err 704 - } 705 - 706 - if t.End >= 0 { 707 - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.End)); err != nil { 708 - return err 709 - } 710 - } else { 711 - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.End-1)); err != nil { 712 - return err 713 - } 714 - } 715 - 716 - // t.Start (int64) (int64) 717 - if len("start") > cbg.MaxLength { 718 - return xerrors.Errorf("Value in field \"start\" was too long") 719 - } 720 - 721 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("start"))); err != nil { 722 - return err 723 - } 724 - if _, err := io.WriteString(w, string("start")); err != nil { 725 - return err 726 - } 727 - 728 - if t.Start >= 0 { 729 - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Start)); err != nil { 730 - return err 731 - } 732 - } else { 733 - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Start-1)); err != nil { 734 - return err 735 - } 736 - } 737 - return nil 738 - } 739 - 740 - func (t *TextSlice) UnmarshalCBOR(r io.Reader) (err error) { 741 - *t = TextSlice{} 742 - 743 - cr := cbg.NewCborReader(r) 744 - 745 - maj, extra, err := cr.ReadHeader() 746 - if err != nil { 747 - return err 748 - } 749 - defer func() { 750 - if err == io.EOF { 751 - err = io.ErrUnexpectedEOF 752 - } 753 - }() 754 - 755 - if maj != cbg.MajMap { 756 - return fmt.Errorf("cbor input should be of type map") 757 - } 758 - 759 - if extra > cbg.MaxLength { 760 - return fmt.Errorf("TextSlice: map struct too large (%d)", extra) 761 - } 762 - 763 - var name string 764 - n := extra 765 - 766 - for i := uint64(0); i < n; i++ { 767 - 768 - { 769 - sval, err := cbg.ReadString(cr) 770 - if err != nil { 771 - return err 772 - } 773 - 774 - name = string(sval) 775 - } 776 - 777 - switch name { 778 - // t.End (int64) (int64) 779 - case "end": 780 - { 781 - maj, extra, err := cr.ReadHeader() 782 - var extraI int64 783 - if err != nil { 784 - return err 785 - } 786 - switch maj { 787 - case cbg.MajUnsignedInt: 788 - extraI = int64(extra) 789 - if extraI < 0 { 790 - return fmt.Errorf("int64 positive overflow") 791 - } 792 - case cbg.MajNegativeInt: 793 - extraI = int64(extra) 794 - if extraI < 0 { 795 - return fmt.Errorf("int64 negative overflow") 796 - } 797 - extraI = -1 - extraI 798 - default: 799 - return fmt.Errorf("wrong type for int64 field: %d", maj) 800 - } 801 - 802 - t.End = int64(extraI) 803 - } 804 - // t.Start (int64) (int64) 805 - case "start": 806 - { 807 - maj, extra, err := cr.ReadHeader() 808 - var extraI int64 809 - if err != nil { 810 - return err 811 - } 812 - switch maj { 813 - case cbg.MajUnsignedInt: 814 - extraI = int64(extra) 815 - if extraI < 0 { 816 - return fmt.Errorf("int64 positive overflow") 817 - } 818 - case cbg.MajNegativeInt: 819 - extraI = int64(extra) 820 - if extraI < 0 { 821 - return fmt.Errorf("int64 negative overflow") 822 - } 823 - extraI = -1 - extraI 824 - default: 825 - return fmt.Errorf("wrong type for int64 field: %d", maj) 826 - } 827 - 828 - t.Start = int64(extraI) 829 - } 830 - 831 - default: 832 - // Field doesn't exist on this type, so ignore it 833 - cbg.ScanForLinks(r, func(cid.Cid) {}) 834 - } 835 - } 836 - 837 - return nil 838 - } 839 21 func (t *CreateOp) MarshalCBOR(w io.Writer) error { 840 22 if t == nil { 841 23 _, err := w.Write(cbg.CborNull)
+6 -6
carstore/repo_test.go
··· 10 10 "testing" 11 11 "time" 12 12 13 - "github.com/bluesky-social/indigo/api" 13 + appbsky "github.com/bluesky-social/indigo/api/bsky" 14 14 "github.com/bluesky-social/indigo/repo" 15 15 "github.com/bluesky-social/indigo/util" 16 16 sqlbs "github.com/ipfs/go-bs-sqlite3" ··· 105 105 t.Fatal(err) 106 106 } 107 107 108 - if _, _, err := rr.CreateRecord(ctx, "app.bsky.feed.post", &api.PostRecord{ 108 + if _, _, err := rr.CreateRecord(ctx, "app.bsky.feed.post", &appbsky.FeedPost{ 109 109 Text: fmt.Sprintf("hey look its a tweet %d", time.Now().UnixNano()), 110 110 }); err != nil { 111 111 t.Fatal(err) ··· 136 136 func setupRepo(ctx context.Context, bs blockstore.Blockstore) (cid.Cid, error) { 137 137 nr := repo.NewRepo(ctx, "did:foo", bs) 138 138 139 - if _, _, err := nr.CreateRecord(ctx, "app.bsky.feed.post", &api.PostRecord{ 139 + if _, _, err := nr.CreateRecord(ctx, "app.bsky.feed.post", &appbsky.FeedPost{ 140 140 Text: fmt.Sprintf("hey look its a tweet %s", time.Now()), 141 141 }); err != nil { 142 142 return cid.Undef, err ··· 187 187 b.Fatal(err) 188 188 } 189 189 190 - if _, _, err := rr.CreateRecord(ctx, "app.bsky.feed.post", &api.PostRecord{ 190 + if _, _, err := rr.CreateRecord(ctx, "app.bsky.feed.post", &appbsky.FeedPost{ 191 191 Text: fmt.Sprintf("hey look its a tweet %s", time.Now()), 192 192 }); err != nil { 193 193 b.Fatal(err) ··· 230 230 b.Fatal(err) 231 231 } 232 232 233 - if _, _, err := rr.CreateRecord(ctx, "app.bsky.feed.post", &api.PostRecord{ 233 + if _, _, err := rr.CreateRecord(ctx, "app.bsky.feed.post", &appbsky.FeedPost{ 234 234 Text: fmt.Sprintf("hey look its a tweet %s", time.Now()), 235 235 }); err != nil { 236 236 b.Fatal(err) ··· 268 268 b.Fatal(err) 269 269 } 270 270 271 - if _, _, err := rr.CreateRecord(ctx, "app.bsky.feed.post", &api.PostRecord{ 271 + if _, _, err := rr.CreateRecord(ctx, "app.bsky.feed.post", &appbsky.FeedPost{ 272 272 Text: fmt.Sprintf("hey look its a tweet %s", time.Now()), 273 273 }); err != nil { 274 274 b.Fatal(err)
+1 -1
gen/main.go
··· 20 20 panic(err) 21 21 } 22 22 23 - if err := cbg.WriteMapEncodersToFile("api/cbor_gen.go", "api", api.PostRecord{}, api.PostEntity{}, api.PostRef{}, api.ReplyRef{}, api.TextSlice{}, api.CreateOp{}); err != nil { 23 + if err := cbg.WriteMapEncodersToFile("api/cbor_gen.go", "api", api.CreateOp{}); err != nil { 24 24 panic(err) 25 25 } 26 26