The encoding scheme is described briefly in the README[0] and the code[1]. To answer your two specific questions, interfaces are represented as a pair (typeNumber, value) where typeNumber maps to a registered type. (Like gob, types must be registered.) Structs are represented as: startCode (fieldNumber value)* endCode. The field numbers are assigned by the generator.
The schema is implicit. The model is protobufs, where there is just enough information in the wire protocol to skip values, but you need something external to interpret types and struct field numbers. [0] https://github.com/jba/codec#encoding-scheme [1] https://github.com/jba/codec/blob/v0.3.1/codecapi/codecapi.go#L200 On Tue, Jan 19, 2021 at 10:50 AM roger peppe <rogpe...@gmail.com> wrote: > This is interesting, thanks! Is there a full description of the encoding > somewhere? (e.g. how are structs represented? what about interface values, > etc? is the schema implicit or sent on the wire?) > cheers, > rog. > > On Tue, 19 Jan 2021 at 14:59, Jonathan Amsterdam <jbamster...@gmail.com> > wrote: > >> Uses code generation for fast encoding and decoding of Go values to >> bytes. Handles sharing and cycles too. >> >> https://pkg.go.dev/github.com/jba/codec >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to golang-nuts+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/golang-nuts/2cc71201-ddbf-4524-88ba-7d0875072d80n%40googlegroups.com >> <https://groups.google.com/d/msgid/golang-nuts/2cc71201-ddbf-4524-88ba-7d0875072d80n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAEymQsRAJKsu2Fe5PwHvTyYW2d1L7ksiJnGfcmPQDohfXtw-yg%40mail.gmail.com.