database

Encode/Decode between struct and byte slice

sbs stands for Struct to Byte Slice and back to Struct Internals: sbs encodes your struct first to a Gob, then it convers it to a byte slice; it reverses the process for decoding. Example type Foo struct { A int B string } p := &Foo{111,"A string"} byteslice, err := sbs.Enc(p) ... foo := new(Foo) structobject, err := sbs.Dec(foo, byteslice) ... Code is available at https://bitbucket.org/gotamer/sbs