Documentation ¶
Overview ¶
Package bert implements the BERT serialization and RPC protocol. See http://bert-rpc.org/
Index ¶
- Constants
- Variables
- func Encode(val interface{}) ([]byte, error)
- func EncodeTo(w io.Writer, val interface{}) (err error)
- func Marshal(w io.Writer, val interface{}) error
- func MarshalResponse(w io.Writer, val interface{}) (err error)
- func Unmarshal(data []byte, val interface{}) (err error)
- func UnmarshalFrom(r io.Reader, val interface{}) (err error)
- type Atom
- type Bitstring
- type List
- type Request
- type Term
- Bugs
Examples ¶
Constants ¶
View Source
const ( VersionTag = 131 SmallIntTag = 97 IntTag = 98 SmallBignumTag = 110 LargeBignumTag = 111 FloatTag = 99 AtomTag = 100 SmallTupleTag = 104 LargeTupleTag = 105 NilTag = 106 StringTag = 107 ListTag = 108 BinTag = 109 BitTag = 77 )
View Source
const ( BertAtom = Atom("bert") NilAtom = Atom("nil") TrueAtom = Atom("true") FalseAtom = Atom("false") )
Variables ¶
View Source
var ErrBadMagic error = errors.New("bad magic")
View Source
var ErrUintType error = errors.New("Unsupported value type uint.")
View Source
var ErrUnknownType error = errors.New("unknown type")
Functions ¶
func MarshalResponse ¶
MarshalResponse encodes val into a BURP Response struct and writes it to w, returning any error.
func Unmarshal ¶
Unmarshal decodes a value from data, stores it in val, and returns any error encountered.
func UnmarshalFrom ¶
UnmarshalFrom decodes a value from r, stores it in val, and returns any error encountered.
Types ¶
type Term ¶
type Term interface{}
func Decode ¶
Decode decodes a Term from data and returns it or an error.
Example ¶
i, err := Decode([]byte{131, 97, 42}) if err != nil { fmt.Println(err) } fmt.Printf("%#v\n", i) s, err := Decode([]byte{131, 107, 0, 3, 102, 111, 111}) if err != nil { fmt.Println(err) } fmt.Printf("%#v\n", s) a, err := Decode([]byte{131, 104, 1, 100, 0, 3, 102, 111, 111}) if err != nil { fmt.Println(err) } fmt.Printf("%#v\n", a)
Output: 42 "foo" []bert.Term{"foo"}
Notes ¶
Bugs ¶
Full BERT specification compliance is still in progress.
Click to show internal directories.
Click to hide internal directories.