July 2019
Intermediate to advanced
458 pages
12h 12m
English
BSON is a format made for documents/entities; therefore, the data structure used for encoding and decoding should be a structure or a map, but not a slice or an array. The mgo version of bson does not offer the usual encoder but only the marshal:
var char = Character{ Name: "Robert", Surname: "Olmstead",}b, err := bson.Marshal(char)if err != nil { log.Fatalln(err)}log.Printf("%q", b)
Read now
Unlock full access