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 ¶
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is the config reader
func NewDirReader ¶
NewDirReader creates new config dir reader
func NewYAMLReader ¶
NewYAMLReader creates new yaml reader from file
func NewYAMLReaderFromReader ¶
NewYAMLReaderFromReader creates new yaml reader from io.Reader
func (*Reader) Base64Default ¶
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) DurationDefault ¶
DurationDefault reads string then parse as duration from config file with default value
func (*Reader) Float32Default ¶
Float32Default reads float32 from config file with default value
func (*Reader) Float64Default ¶
Float64Default reads float64 from config file with default value
func (*Reader) Int64Default ¶
Int64Default reads int64 from config file with default value
func (*Reader) IntDefault ¶
IntDefault reads int from config file with default value
func (*Reader) MustBase64 ¶
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) MustDuration ¶
MustDuration reads string then parse as duration from config file, panic if file not exists
func (*Reader) MustFloat32 ¶
MustFloat32 reads float32 from config file, panic if file not exists or data can not parse to float32
func (*Reader) MustFloat64 ¶
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 ¶
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