forked from bluesky-social/indigo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
74 lines (64 loc) · 2.76 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package main
import (
"reflect"
"github.com/bluesky-social/indigo/api"
atproto "github.com/bluesky-social/indigo/api/atproto"
bsky "github.com/bluesky-social/indigo/api/bsky"
label "github.com/bluesky-social/indigo/api/label"
"github.com/bluesky-social/indigo/events"
lexutil "github.com/bluesky-social/indigo/lex/util"
"github.com/bluesky-social/indigo/mst"
"github.com/bluesky-social/indigo/repo"
cbg "github.com/whyrusleeping/cbor-gen"
)
func main() {
var typVals []any
for _, typ := range mst.CBORTypes() {
typVals = append(typVals, reflect.New(typ).Elem().Interface())
}
if err := cbg.WriteMapEncodersToFile("mst/cbor_gen.go", "mst", typVals...); err != nil {
panic(err)
}
if err := cbg.WriteMapEncodersToFile("repo/cbor_gen.go", "repo", repo.SignedCommit{}, repo.UnsignedCommit{}); err != nil {
panic(err)
}
if err := cbg.WriteMapEncodersToFile("api/cbor_gen.go", "api", api.CreateOp{}); err != nil {
panic(err)
}
if err := cbg.WriteMapEncodersToFile("api/bsky/cbor_gen.go", "bsky",
bsky.FeedPost{}, bsky.FeedRepost{}, bsky.FeedPost_Entity{},
bsky.FeedPost_ReplyRef{}, bsky.FeedPost_TextSlice{}, bsky.EmbedImages{},
bsky.EmbedExternal{}, bsky.EmbedExternal_External{},
bsky.EmbedImages_Image{}, bsky.GraphFollow{}, bsky.ActorProfile{},
bsky.EmbedRecord{}, bsky.FeedLike{}, bsky.RichtextFacet{},
bsky.RichtextFacet_ByteSlice{},
bsky.RichtextFacet_Link{}, bsky.RichtextFacet_Mention{},
bsky.EmbedRecordWithMedia{},
bsky.FeedDefs_NotFoundPost{},
bsky.GraphBlock{},
bsky.GraphList{},
bsky.GraphListitem{},
bsky.FeedGenerator{},
/*bsky.EmbedImages_View{},
bsky.EmbedRecord_View{}, bsky.EmbedRecordWithMedia_View{},
bsky.EmbedExternal_View{}, bsky.EmbedImages_ViewImage{},
bsky.EmbedExternal_ViewExternal{}, bsky.EmbedRecord_ViewNotFound{},
bsky.FeedDefs_ThreadViewPost{}, bsky.EmbedRecord_ViewRecord{},
bsky.FeedDefs_PostView{}, bsky.ActorDefs_ProfileViewBasic{},
*/
); err != nil {
panic(err)
}
if err := cbg.WriteMapEncodersToFile("api/atproto/cbor_gen.go", "atproto", atproto.RepoStrongRef{}, atproto.SyncSubscribeRepos_Commit{}, atproto.SyncSubscribeRepos_Handle{}, atproto.SyncSubscribeRepos_Info{}, atproto.SyncSubscribeRepos_Migrate{}, atproto.SyncSubscribeRepos_RepoOp{}, atproto.SyncSubscribeRepos_Tombstone{}); err != nil {
panic(err)
}
if err := cbg.WriteMapEncodersToFile("api/label/cbor_gen.go", "label", label.Label{}, label.SubscribeLabels_Info{}, label.SubscribeLabels_Labels{}); err != nil {
panic(err)
}
if err := cbg.WriteMapEncodersToFile("lex/util/cbor_gen.go", "util", lexutil.CborChecker{}, lexutil.LegacyBlob{}, lexutil.BlobSchema{}); err != nil {
panic(err)
}
if err := cbg.WriteMapEncodersToFile("events/cbor_gen.go", "events", events.EventHeader{}, events.ErrorFrame{}); err != nil {
panic(err)
}
}