Skip to content

clavoie/binu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

binu GoDoc Build Status codecov Go Report Card

Binary / byte utilities for Go.

Currently this package is just a wrapper around the encoding/gob package, with hooks for dependency injection.

type Foo struct {
  Value int
}

foo := &Foo{10}
bytes, err := binu.ToGob(foo)

// if err etc

newFoo := new(Foo)
err = binu.FromGob(bytes, newFoo)

// if err etc
// newFoo.Value == foo.Value

If you'd prefer to use dependency injection:

func Serialize(gobber binu.Gobber) error {
  err := gobber.To(value)

  // etc
}