structs/README.md
Fatih Arslan 76054e3735 Update README.md
Also add GOLANG for google search visibility.
2014-07-26 19:38:58 +03:00

747 B

Structure GoDoc Build Status

Structure contains various utilitis to work with Go (Golang) structs.

Install

go get github.com/fatih/structure

Example

Below is an example that is converting a struct to a map

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}