Skip to content

daluntw/maptostruct

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

maptostruct

Convert map[string]interface{} to type struct

Install

go get -t github.com/daluntw/maptostruct

Usage

package main

import "github.com/daluntw/maptostruct"

func main() {

    data := make(map[string]interface{})
    data["foo"] = "bar"

    type Struct struct {
        Foo string `json:"foo"`
    }

    var output Struct

    if err := maptostruct.MapToStruct(data, &output); err != nil {
        panic(err)
    }   

    print(output.Foo)
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages