Documentation ¶
Index ¶
- func LoadDotEnv(filename ...string) error
- type Reader
- func (r *Reader) Base64(name string) []byte
- func (r *Reader) Base64Default(name string, def []byte) []byte
- func (r *Reader) Bool(name string) bool
- func (r *Reader) BoolDefault(name string, def bool) bool
- func (r *Reader) Bytes(name string) []byte
- func (r *Reader) BytesDefault(name string, def []byte) []byte
- func (r *Reader) Duration(name string) time.Duration
- func (r *Reader) DurationDefault(name string, def time.Duration) time.Duration
- func (r *Reader) Fallback(f *Reader) *Reader
- func (r *Reader) Float32(name string) float32
- func (r *Reader) Float32Default(name string, def float32) float32
- func (r *Reader) Float64(name string) float64
- func (r *Reader) Float64Default(name string, def float64) float64
- func (r *Reader) Int(name string) int
- func (r *Reader) Int64(name string) int64
- func (r *Reader) Int64Default(name string, def int64) int64
- func (r *Reader) IntDefault(name string, def int) int
- func (r *Reader) MustBase64(name string) []byte
- func (r *Reader) MustBool(name string) bool
- func (r *Reader) MustBytes(name string) []byte
- func (r *Reader) MustDuration(name string) time.Duration
- func (r *Reader) MustFloat32(name string) float32
- func (r *Reader) MustFloat64(name string) float64
- func (r *Reader) MustInt(name string) int
- func (r *Reader) MustInt64(name string) int64
- func (r *Reader) MustString(name string) string
- func (r *Reader) String(name string) string
- func (r *Reader) StringDefault(name string, def string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadDotEnv ¶ added in v1.6.0
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is the config reader
func NewDirReader ¶ added in v1.2.0
NewDirReader creates new config dir reader
func NewYAMLReader ¶ added in v1.2.0
NewYAMLReader creates new yaml reader from file
func NewYAMLReaderFromReader ¶ added in v1.7.0
NewYAMLReaderFromReader creates new yaml reader from io.Reader
func (*Reader) Base64 ¶ added in v1.5.0
Base64 reads string from config file then decode using base64
func (*Reader) Base64Default ¶ added in v1.5.0
Base64Default reads string from config file then decode using base64 if error, will return default value
func (*Reader) BoolDefault ¶
BoolDefault reads bool from config file with default value, result is false if lower case data is "", "0", or "false", otherwise true
func (*Reader) BytesDefault ¶
BytesDefault reads bytes from config file with default value
func (*Reader) Duration ¶ added in v1.3.0
Duration reads string then parse as duration from config file
func (*Reader) DurationDefault ¶ added in v1.3.0
DurationDefault reads string then parse as duration from config file with default value
func (*Reader) Float32Default ¶ added in v1.9.0
Float32Default reads float32 from config file with default value
func (*Reader) Float64Default ¶ added in v1.9.0
Float64Default reads float64 from config file with default value
func (*Reader) Int64Default ¶ added in v1.3.0
Int64Default reads int64 from config file with default value
func (*Reader) IntDefault ¶
IntDefault reads int from config file with default value
func (*Reader) MustBase64 ¶ added in v1.5.0
MustBase64 reads string from config file then decode using base64 if error, will panic
func (*Reader) MustBool ¶
MustBool reads bool from config file, see BoolDefault, panic if file not exists
func (*Reader) MustBytes ¶ added in v1.1.0
MustBytes reads bytes from config file, panic if file not exists
func (*Reader) MustDuration ¶ added in v1.3.0
MustDuration reads string then parse as duration from config file, panic if file not exists
func (*Reader) MustFloat32 ¶ added in v1.9.0
MustFloat32 reads float32 from config file, panic if file not exists or data can not parse to float32
func (*Reader) MustFloat64 ¶ added in v1.9.0
MustFloat64 reads float64 from config file, panic if file not exists or data can not parse to float64
func (*Reader) MustInt ¶
MustInt reads int from config file, panic if file not exists or data can not parse to int
func (*Reader) MustInt64 ¶ added in v1.3.0
MustInt64 reads int64 from config file, panic if file not exists or data can not parse to int64
func (*Reader) MustString ¶
MustString reads string from config file, panic if file not exists