Skip to content

fengzxu/yaml2go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yaml2go

Just another tool that convert YAML to GO struct.

What's for:

Before:

web: 172.16.20.30:19000
db:
  ch:
    url: 172.16.20.20:9000
    port: 19000
    ver: 19.09
    user: default
    passwd: somepassword
    some_list:
      - aaaaa
      - bbbb

After:

package Config

type Config struct {
	Web string `yaml:"web"`
	Db  struct {
		Ch struct {
			Passwd   string   `yaml:"passwd"`
			Url      string   `yaml:"url"`
			Port     int      `yaml:"port"`
			Ver      float64  `yaml:"ver"`
			User     string   `yaml:"user"`
			SomeList []string `yaml:"some_list"`
		}
	}
}

See example.go for usage.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages