code: func structToMap(v reflect.Value) map[string]interface{} {
  	out := make(map[string]interface{})
  	t := v.Type()
  	for i := 0; i < t.NumField(); i++ {
  		field := t.Field(i)
  		if field.PkgPath != "" {
  			// unexported field. skip.
  			continue
  		}
  		out[field.Name] = v.FieldByName(field.Name).Interface()
  	}
  	return out
  }
docs: // Converts the top level of a struct to a map[string]interface{}.
  // Code inspired by github.com/fatih/structs.