A Go parser for Postcard binary wire format.
Follows the same design principles as jsony, which allows for fast, type-safe, and reflection-free deserialization.
go get github.com/orsinium-labs/postcardtype User struct {
name string
age uint16
}
var user User
parse := postcard.Struct(
postcard.Str(&user.name),
postcard.U16(&user.age),
)
reader := bytes.NewReader([]byte("\x07Aragorn\x52"))
err := parse(reader)
fmt.Println(err) // nil
fmt.Println(user.name) // "Aragorn"
fmt.Println(user.age) // 82