go-toml:TOML语言的Go库

时间:2021-02-03 14:20:16
【文件属性】:
文件名称:go-toml:TOML语言的Go库
文件大小:120KB
文件格式:ZIP
更新时间:2021-02-03 14:20:16
go toml toml-parsing Go 转到 转到格式的库。 该库支持TOML版本 产品特点 Go-toml提供以下功能,用于使用从TOML文档解析的数据: 从文件和字符串数据加载TOML文档 使用Tree轻松浏览TOML结构 往返数据结构的封送和拆封 所有已解析元素的行和列位置数据 语法错误包含行号和列号 进口 import "github.com/pelletier/go-toml" 使用范例 阅读TOML文档: config , _ := toml . Load ( ` [postgres] user = "pelletier" password = "mypassword"` ) // retrieve data directly user := config . Get ( "postgres.user" ).( string ) // or using an intermediate object postgresConfig := config . Get ( "postgres" ).( * toml. Tree ) password := postgresConfig . Get ( "passwo

网友评论