erlpack

package module
v0.0.0-...-2e5e80b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2021 License: BSD-2-Clause Imports: 9 Imported by: 0

README

go-erlpack

A Go port of Discord's erlpack (initially written for JS/Python/C++ by Discord).

Documentation

Index

Constants

This section is empty.

Variables

View Source
var INITIAL_ALLOC = uint(1024 * 1024)

INITIAL_ALLOC is the initial allocation.

Functions

func Pack

func Pack(Interface interface{}) ([]byte, error)

Pack is used to pack a interface given to it. Note that to ensure compatibility in codebases where you have both erlpack and json, json.RawMessage is treated the same as erlpack.RawData.

func Unpack

func Unpack(Data []byte, Ptr interface{}) error

Unpack is used to unpack a value to a pointer. Note that to ensure compatibility in codebases where you have both erlpack and json, json.RawMessage is treated the same as erlpack.RawData.

func UnpackReader

func UnpackReader(reader io.Reader, Ptr interface{}) error

UnpackReader is used to unpack a value to a pointer from a reader. Note that to ensure compatibility in codebases where you have both erlpack and json, json.RawMessage is treated the same as erlpack.RawData.

Types

type Atom

type Atom string

Atom is used to define an atom within the codebase.

type RawData

type RawData []byte

RawData is used to define data which was within an Erlpack array but has not been parsed yet. This is different to UncastedResult since it has not been processed yet.

func (RawData) Cast

func (r RawData) Cast(Ptr interface{}) error

Cast is used to cast the result to a pointer.

type UncastedResult

type UncastedResult struct {
	// contains filtered or unexported fields
}

UncastedResult is used to define a result which has not been casted yet. You can call Cast on this to cast the item after the initial unpacking.

func (*UncastedResult) Cast

func (u *UncastedResult) Cast(Ptr interface{}) error

Cast is used to cast the result to a pointer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL