Ai
1 Star 0 Fork 3.4K

andyLin/LearningNotes

forked from 陌溪/LearningNotes 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
init.go 446 Bytes
一键复制 编辑 原始数据 按行查看 历史
陌溪 提交于 2020-09-17 18:38 +08:00 . docs:增加Gin框架学习笔记和代码
package main
import (
"fmt"
"reflect"
)
// ini配置文件解析器
// MysqlConfig MySQL配置结构体
type MysqlConfig struct {
Address string `ini:"address"`
Port int `ini:"port"`
Username string `ini:"username"`
Password string `ini:"password"`
}
func loadIni(x interface{}) {
v := reflect.ValueOf(x)
fmt.Println(v)
}
func main() {
var mc MysqlConfig
loadIni(&mc)
fmt.Println(mc.Address, mc.Port, mc.Username, mc.Password)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/andy1234/LearningNotes.git
git@gitee.com:andy1234/LearningNotes.git
andy1234
LearningNotes
LearningNotes
master

搜索帮助