1
0
mirror of https://github.com/astaxie/beego.git synced 2025-06-14 09:20:39 +00:00

Upgrade toml version

This commit is contained in:
Ming Deng
2020-10-14 00:24:22 +08:00
parent ccf873fa8b
commit 3fc21ae6ec
6 changed files with 20 additions and 5 deletions

View File

@ -186,10 +186,6 @@ func (c *BaseConfiger) Strings(key string) ([]string, error) {
return strings.Split(res, ";"), nil
}
func (c *BaseConfiger) Unmarshaler(prefix string, obj interface{}, opt ...DecodeOption) error {
return errors.New("unsupported operation")
}
func (c *BaseConfiger) Sub(key string) (Configer, error) {
return nil, errors.New("unsupported operation")
}

View File

@ -98,6 +98,10 @@ func (c *fakeConfigContainer) SaveConfigFile(filename string) error {
return errors.New("not implement in the fakeConfigContainer")
}
func (c *fakeConfigContainer) Unmarshaler(prefix string, obj interface{}, opt ...DecodeOption) error {
return errors.New("unsupported operation")
}
var _ Configer = new(fakeConfigContainer)
// NewFakeConfig return a fake Configer

View File

@ -27,6 +27,8 @@ import (
"strconv"
"strings"
"sync"
"github.com/mitchellh/mapstructure"
)
var (
@ -505,6 +507,13 @@ func (c *IniConfigContainer) getdata(key string) string {
return ""
}
func (c *IniConfigContainer) Unmarshaler(prefix string, obj interface{}, opt ...DecodeOption) error {
if len(prefix) > 0 {
return errors.New("unsupported prefix params")
}
return mapstructure.Decode(c.data, opt)
}
func init() {
Register("ini", &IniConfig{})
}