Serialize

Golang: Serialize struct using gob: Part 2

[Golang: Serialize struct using gob — Part 2 In this article we will explore following functions of gob func (dec \*Decoder) Decode(e interface{}) error func (enc \*Encoder) Encode(e interface{}) error Encode and Decode functions are helpful when you want to write network application. Example 1: Simple encoding and decoding student structure package main import ( "fmt" "encoding/gob" "bytes" ) type Student struct { Name string Age int32 } func main() { fmt.

Read more →

Golang: Serialize struct using gob: Part 1

Golang: Serialize struct using gob: Part 1 Serialize of the struct will help you to transfer data over network or it will help you to write data on disk. In a distributed system you generate data then serialize, compress and send. On other end you receive data then decompress, deserialize and process. The entire process must be fast and efficient. Go lang has it’s own serialize format called gob. Using gob you can encode and decode structure.

Read more →