structs/README.md
2014-07-26 17:43:29 +03:00

674 B

Structure GoDoc Build Status

Structure contains various utilitis to work with Go structs.

Install

go get github.com/fatih/structure

Examples

type Server struct {
	Name    string
	ID      int32
	Enabled bool
}

s := &Server{
	Name:    "Arslan",
	ID:      123456,
	Enabled: true,
}

m, err := structure.ToMap(s)
if err != nil {
	panic(err)
}

fmt.Printf("%#v", m)
// Output: map[string]interface {}{"Name":"Arslan", "ID":123456, "Enabled":true}