func (c *Config) SetEncoders(encoders map[string]Encoder) {
	for format, encoder := range encoders {
		c.SetEncoder(format, encoder)
	}
}
SetEncoders set encoders
Deprecated
please use driver instead
package config
import (
	"bytes"
	"fmt"
	"os"
	"reflect"
	"regexp"
	"strings"
	"sync"
	"text/scanner"
	"github.com/mitchellh/mapstructure"
)
const (
	Ini  = "ini"
	Hcl  = "hcl"
	Yml  = "yml"
	JSON = "json"
	Yaml = "yaml"
	Toml = "toml"
	defaultDelimiter byte = '.'
	defaultStructTag = "mapstructure"
)
type intArr []int
type strArr []string
type intMap map[string]int
type strMap map[string]string
var dc = New("default")
type Driver interface {
	Name() string
	GetDecoder() Decoder
	GetEncoder() Encoder
}
type Decoder func(blob []byte, v interface{}) (err error)
type Encoder func(v interface{}) (out []byte, err error)
type Options struct {
	ParseEnv bool
	Readonly bool
	EnableCache bool
	ParseKey bool
	TagName string
	Delimiter byte
	DumpFormat string
	ReadFormat string
	DecoderConfig *mapstructure.DecoderConfig
}
type Config struct {
	err error
	name string
	lock sync.RWMutex
	opts *Options
	data map[string]interface{}
	loadedFiles  []string
	loadedDriver []string
	decoders map[string]Decoder
	encoders map[string]Encoder
	intCache map[string]int
	strCache map[string]string
	iArrCache map[string]intArr
	iMapCache map[string]intMap
	sArrCache map[string]strArr
	sMapCache map[string]strMap
}
func New(name string) *Config {
	return &Config{
		name: name,
		opts: newDefaultOption(),
		data: make(map[string]interface{}),
		encoders: map[string]Encoder{JSON: JSONEncoder},
		decoders: map[string]Decoder{JSON: JSONDecoder},
	}
}
func NewEmpty(name string) *Config {
	return &Config{
		name: name,
		opts: newDefaultOption(),
		data: make(map[string]interface{}),
		encoders: map[string]Encoder{},
		decoders: map[string]Decoder{},
	}
}
func NewWith(name string, fn func(c *Config)) *Config {
	return New(name).With(fn)
}
func NewWithOptions(name string, opts ...func(*Options)) *Config {
	return New(name).WithOptions(opts...)
}
func Default() *Config {
	return dc
}
func newDefaultOption() *Options {
	return &Options{
		ParseKey:  true,
		TagName:   defaultStructTag,
		Delimiter: defaultDelimiter,
		DumpFormat: JSON,
		ReadFormat: JSON,
		DecoderConfig: newDefaultDecoderConfig(),
	}
}
func newDefaultDecoderConfig() *mapstructure.DecoderConfig {
	return &mapstructure.DecoderConfig{
		TagName: defaultStructTag,
		WeaklyTypedInput: true,
	}
}
func ParseEnvVarStringHookFunc() mapstructure.DecodeHookFunc {
	return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) {
		if f.Kind() != reflect.String {
			return data, nil
		}
		str := ParseEnvValue(data.(string))
		return str, nil
	}
}
func ParseEnv(opts *Options) { opts.ParseEnv = true }
func Readonly(opts *Options) { opts.Readonly = true }
func Delimiter(sep byte) func(*Options) {
	return func(opts *Options) {
		opts.Delimiter = sep
	}
}
func EnableCache(opts *Options) { opts.EnableCache = true }
func WithOptions(opts ...func(*Options)) { dc.WithOptions(opts...) }
func (c *Config) WithOptions(opts ...func(*Options)) *Config {
	if !c.IsEmpty() {
		panic("config: Cannot set options after data has been loaded")
	}
	for _, opt := range opts {
		opt(c.opts)
	}
	return c
}
func GetOptions() *Options { return dc.Options() }
func (c *Config) Options() *Options {
	return c.opts
}
func (c *Config) With(fn func(c *Config)) *Config {
	fn(c)
	return c
}
func (c *Config) Readonly() {
	c.opts.Readonly = true
}
func AddDriver(driver Driver) { dc.AddDriver(driver) }
func (c *Config) AddDriver(driver Driver) {
	format := driver.Name()
	c.decoders[format] = driver.GetDecoder()
	c.encoders[format] = driver.GetEncoder()
}
func (c *Config) HasDecoder(format string) bool {
	format = fixFormat(format)
	_, ok := c.decoders[format]
	return ok
}
func SetDecoder(format string, decoder Decoder) {
	dc.SetDecoder(format, decoder)
}
func (c *Config) SetDecoder(format string, decoder Decoder) {
	format = fixFormat(format)
	c.decoders[format] = decoder
}
func (c *Config) SetDecoders(decoders map[string]Decoder) {
	for format, decoder := range decoders {
		c.SetDecoder(format, decoder)
	}
}
func SetEncoder(format string, encoder Encoder) {
	dc.SetEncoder(format, encoder)
}
func (c *Config) SetEncoder(format string, encoder Encoder) {
	format = fixFormat(format)
	c.encoders[format] = encoder
}