Skip to content

HungYann/go-config-reflect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-config-reflect

Homemade deserialization tool

Go

English:

go-config-reflect is a golang deserialization code written by myself. Its main function is to use principle reflection to convert the file content into a struct structure in go.

The main function of the program is to convert the ./file/config.json file into the content in the Config structure

  • before:
{
  "config_name1": "配置名称1",
  "config_name2": "配置名称2",
  "config_name3": "true",
  "config_name4": "100",
  "config_name5": "10.0"
}
  • after:
&config.Config{ConfigName1:"配置名称1", ConfigName2:"配置名称2", ConfigName3:true, ConfigName4:100, ConfigName5:10}
  • runtime result:
image

中文简体:

go-config-reflect是本人手工写的golang反序列化代码,主要作用是利用原理反射,将文件内容转化成go中struct结构体

程序的主要功能是将./file/config.json文件转化成Config结构体中的内容

  • 运行前
{
  "config_name1": "配置名称1",
  "config_name2": "配置名称2",
  "config_name3": "true",
  "config_name4": "100",
  "config_name5": "10.0"
}
  • 运行后
&config.Config{ConfigName1:"配置名称1", ConfigName2:"配置名称2", ConfigName3:true, ConfigName4:100, ConfigName5:10}
  • 运行结果:
image

About

Homemade deserialization tool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages