Documentation ¶
Index ¶
- Constants
- Variables
- func CborEncodeMajorType(t byte, l uint64) []byte
- func CborReadHeader(br io.Reader) (byte, uint64, error)
- func CborReadHeaderBuf(br io.Reader, scratch []byte) (byte, uint64, error)
- func CborWriteHeader(w io.Writer, t byte, l uint64) error
- func EncodeBool(b bool) []byte
- func GenMapEncodersForType(inpkg string, i interface{}, w io.Writer) error
- func GenTupleEncodersForType(inpkg string, i interface{}, w io.Writer) error
- func PrintHeaderAndUtilityMethods(w io.Writer, pkg string) error
- func ReadByteArray(br io.Reader, maxlen uint64) ([]byte, error)
- func ReadCid(br io.Reader) (cid.Cid, error)
- func ReadString(r io.Reader) (string, error)
- func ReadStringBuf(r io.Reader, scratch []byte) (string, error)
- func ReadTaggedByteArray(br io.Reader, exptag uint64, maxlen uint64) ([]byte, error)
- func ScanForLinks(br io.Reader, cb func(cid.Cid)) error
- func WriteBool(w io.Writer, b bool) error
- func WriteCid(w io.Writer, c cid.Cid) error
- func WriteCidBuf(buf []byte, w io.Writer, c cid.Cid) error
- func WriteMajorTypeHeader(w io.Writer, t byte, l uint64) error
- func WriteMajorTypeHeaderBuf(buf []byte, w io.Writer, t byte, l uint64) error
- func WriteMapEncodersToFile(fname, pkg string, types ...interface{}) error
- func WriteTupleEncodersToFile(fname, pkg string, types ...interface{}) error
- type BytePeeker
- type CBORMarshaler
- type CBORUnmarshaler
- type CborBool
- type CborCid
- type CborInt
- type Deferred
- type Field
- type GenTypeInfo
Constants ¶
View Source
const ( MajUnsignedInt = 0 MajNegativeInt = 1 MajByteString = 2 MajTextString = 3 MajArray = 4 MajMap = 5 MajTag = 6 MajOther = 7 )
View Source
const ByteArrayMaxLen = 2 << 20
View Source
const MaxLength = 8192
Variables ¶
View Source
var ( CborBoolFalse = []byte{0xf4} CborBoolTrue = []byte{0xf5} CborNull = []byte{0xf6} )
Functions ¶
func CborEncodeMajorType ¶
func CborReadHeaderBuf ¶
same as the above, just tries to allocate less by using a passed in scratch buffer
func EncodeBool ¶
func GenMapEncodersForType ¶
Generates 'tuple representation' cbor encoders for the given type
func GenTupleEncodersForType ¶
Generates 'tuple representation' cbor encoders for the given type
func ReadTaggedByteArray ¶
func WriteMajorTypeHeader ¶
TODO: No matter what I do, this function *still* allocates. Its super frustrating. See issue: https://github.com/golang/go/issues/33160
func WriteMajorTypeHeaderBuf ¶
Same as the above, but uses a passed in buffer to avoid allocations
func WriteMapEncodersToFile ¶
Types ¶
type BytePeeker ¶
this is a bit gnarly i should just switch to taking in a byte array at the top level
func GetPeeker ¶
func GetPeeker(r io.Reader) BytePeeker
type CBORMarshaler ¶
type CBORUnmarshaler ¶
type GenTypeInfo ¶
func ParseTypeInfo ¶
func ParseTypeInfo(pkg string, i interface{}) (*GenTypeInfo, error)
func (GenTypeInfo) MapHeader ¶
func (gti GenTypeInfo) MapHeader() []byte
func (GenTypeInfo) MapHeaderAsByteString ¶
func (gti GenTypeInfo) MapHeaderAsByteString() string
func (*GenTypeInfo) NeedsScratch ¶
func (gti *GenTypeInfo) NeedsScratch() bool
func (GenTypeInfo) TupleHeader ¶
func (gti GenTypeInfo) TupleHeader() []byte
func (GenTypeInfo) TupleHeaderAsByteString ¶
func (gti GenTypeInfo) TupleHeaderAsByteString() string
Click to show internal directories.
Click to hide internal directories.