类似于Windows下的INI文件. 配置文件形式为[section] 的段构成
key2,key3,key3,key2。
Package config is a Configuration file parser for INI format 包 config 是一个简捷方的,error)Set(key string, err := NewConfig(testdata/testini.ini)c.Int(port)// result is int 8080c.Int64(port)// result is int64 8080c.Float64(f64)// result is float64 64.1c.String(host)// result is string act.wikic.String(mysql.host)// result is string 127.0.0.1c.String(redis.host)// result is string 127.0.0.3c.Strings(redis.key)// result is []string{key1, value string) error更多信息所有字符理会均利用小写的!源码 https://github.com/lxmgo/config ,可以安排于任意的单唯一行中. 安装go get github.com/lxmgo/config示例 请查察 conf.ini 文件作为利用示例 利用类型 示例设置文件: [DEFAULT]host = act.wikiport = 8080f64 = 64.1[mysql]host = 127.0.0.1[mongodb]host = 127.0.0.2[redis]host = 127.0.0.3push_key = key1,...[memcache]host = 127.0.0.4 加载设置文件: config,支持注释的Go语言设置文件理会器,...}config APIS:String(key string) stringStrings(key string) []stringBool(key string) (bool,雷同于Windows下的INI文件. 设置文件形式为[section] 的段组成, 内部利用 name=value键值对 假如为指定段节点,则默认放入名为[default]的段傍边. #为注释的开头, error)Int64(key string) (int64, error)Float64(key string) (float64, error)Int(key string) (int,。
相关热词:
本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!
本文地址: https://v30.fanwenzhu.com/jiaob/go/12470.shtml
相关文章
热门TAG
win10 ecshop 主机 阿里云 解决 配置 C# C++ 解析 SQL语句 命令 Go语言 方法 CSS3 HTML5 CSS win7 MSSQL 服务器配置 IIS7.5 IIS7 IIS6 IIS CentOS 7 Linux oracle数据库 oracle phpcms discuz discuz教程最新文章
-
Lisp进修Windows下面的开拓情
时间:2021-01-12
-
Lisp进修Windows下面的开拓情
时间:2021-01-12
-
为Go语言GC正名-2秒到1毫
时间:2020-12-27
-
go语言初探 一个helloworld编
时间:2020-12-27
热门文章
-
为Go语言GC正名-2秒到1毫秒的演变史
时间:2020-12-27
-
Lisp进修Windows下面的开拓情况搭建
时间:2021-01-12
-
Lisp进修Windows下面的开拓情况搭建
时间:2021-01-12
-
go语言初探 一个helloworld编译出来有2.2M!
时间:2020-12-27
