Skip to content

orsinium-labs/postcard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

postcard

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.

Installation

go get github.com/orsinium-labs/postcard

Usage

type 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

Releases

No releases published

Contributors

Languages