1 Star 0 Fork 0

GoAdmin / admin-core

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
toml.go 566 Bytes
一键复制 编辑 原始数据 按行查看 历史
GoAdmin 提交于 2022-06-08 16:39 . test
package toml
import (
"bytes"
"github.com/BurntSushi/toml"
"github.com/go-admin-team/go-admin-core/config/encoder"
)
type tomlEncoder struct{}
func (t tomlEncoder) Encode(v interface{}) ([]byte, error) {
b := bytes.NewBuffer(nil)
defer b.Reset()
err := toml.NewEncoder(b).Encode(v)
if err != nil {
return nil, err
}
return b.Bytes(), nil
}
func (t tomlEncoder) Decode(d []byte, v interface{}) error {
return toml.Unmarshal(d, v)
}
func (t tomlEncoder) String() string {
return "toml"
}
func NewEncoder() encoder.Encoder {
return tomlEncoder{}
}
Go
1
https://gitee.com/GoAdminCore/admin-core.git
git@gitee.com:GoAdminCore/admin-core.git
GoAdminCore
admin-core
admin-core
v1.0.0

搜索帮助

53164aa7 5694891 3bd8fe86 5694891