albertwidi / go-structmap

Struct conversion to map

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Struct map

This module is used to convert struct into map recursively

Example

import stm "github.com/alileza/go-structmap"

type MyStruct struct{}

func main(){
    myStruct := &MyStruct{}
    fmt.Println(stm.StructToMap(*myStruct))

    // if you put true on the second parameter
    // it will convert all of your datatype into string
    // unless (bool, nil)
    fmt.Println(stm.StructToMap(*myStruct, true))
}

About

Struct conversion to map


Languages

Language:Go 100.0%