A small library for converting a struct to a map for easy iteration with for/range.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.travis.yml
LICENSE
README.md
structtomap.go
structtomap_test.go

README.md

Release Version Build Status Coverage Status Go Walker Documentation Licence

StructToMap

A simple library for converting a struct to a map in Go.

package main

import "fmt"

type AwesomeStruct struct {
  Stuff     string
  MoreStuff string
  IntStuff  int
}

func main() {
  newStruct := AwesomeStruct{"testing", "testing more", 7}

  newMap := structtomap.convert(newStruct)

  fmt.Println(newMap["Stuff"]) //Prints "testing"
}