Documentation ¶
Index ¶
- func NewNiceEnv(params ...interface{}) (interface{}, error)
- func NewNiceTestingEnv(params ...interface{}) (interface{}, error)
- type NiceEnv
- type NiceEnvProvider
- func (provider *NiceEnvProvider) Boot(c framework.Container) error
- func (provider *NiceEnvProvider) IsDefer() bool
- func (provider *NiceEnvProvider) Name() string
- func (provider *NiceEnvProvider) Params(c framework.Container) []interface{}
- func (provider *NiceEnvProvider) Register(c framework.Container) framework.NewInstance
- type NiceTestingEnv
- type NiceTestingEnvProvider
- func (provider *NiceTestingEnvProvider) Boot(c framework.Container) error
- func (provider *NiceTestingEnvProvider) IsDefer() bool
- func (provider *NiceTestingEnvProvider) Name() string
- func (provider *NiceTestingEnvProvider) Params(c framework.Container) []interface{}
- func (provider *NiceTestingEnvProvider) Register(c framework.Container) framework.NewInstance
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNiceEnv ¶
func NewNiceEnv(params ...interface{}) (interface{}, error)
NewNiceEnv 有一个参数,.env文件所在的目录 example: NewNiceEnv("/envfolder/") 会读取文件: /envfolder/.env .env的文件格式 FOO_ENV=BAR
func NewNiceTestingEnv ¶
func NewNiceTestingEnv(params ...interface{}) (interface{}, error)
NewNiceTestingEnv NewNiceEnv 有一个参数,.env文件所在的目录 example: NewNiceEnv("/envfolder/") 会读取文件: /envfolder/.env .env的文件格式 FOO_ENV=BAR
Types ¶
type NiceEnv ¶
type NiceEnv struct {
// contains filtered or unexported fields
}
NiceEnv 是 Env 的具体实现
type NiceEnvProvider ¶
type NiceEnvProvider struct {
Folder string
}
func (*NiceEnvProvider) Boot ¶
func (provider *NiceEnvProvider) Boot(c framework.Container) error
Boot will called when the service instantiate
func (*NiceEnvProvider) IsDefer ¶
func (provider *NiceEnvProvider) IsDefer() bool
IsDefer define whether the service instantiate when first make or register
func (*NiceEnvProvider) Name ¶
func (provider *NiceEnvProvider) Name() string
Name / Name define the name for this service
func (*NiceEnvProvider) Params ¶
func (provider *NiceEnvProvider) Params(c framework.Container) []interface{}
Params define the necessary params for NewInstance
func (*NiceEnvProvider) Register ¶
func (provider *NiceEnvProvider) Register(c framework.Container) framework.NewInstance
Register register a new function for make a service instance
type NiceTestingEnv ¶
type NiceTestingEnv struct {
// contains filtered or unexported fields
}
NiceTestingEnv NiceEnv 是 Env 的具体实现
func (*NiceTestingEnv) All ¶
func (en *NiceTestingEnv) All() map[string]string
All 获取所有的环境变量,.env和运行环境变量融合后结果
func (*NiceTestingEnv) AppEnv ¶
func (en *NiceTestingEnv) AppEnv() string
AppEnv 获取表示当前APP环境的变量APP_ENV
func (*NiceTestingEnv) Get ¶
func (en *NiceTestingEnv) Get(key string) string
Get 获取某个环境变量,如果没有设置,返回""
func (*NiceTestingEnv) IsExist ¶
func (en *NiceTestingEnv) IsExist(key string) bool
IsExist 判断一个环境变量是否有被设置
type NiceTestingEnvProvider ¶
type NiceTestingEnvProvider struct {
Folder string
}
func (*NiceTestingEnvProvider) Boot ¶
func (provider *NiceTestingEnvProvider) Boot(c framework.Container) error
Boot will called when the service instantiate
func (*NiceTestingEnvProvider) IsDefer ¶
func (provider *NiceTestingEnvProvider) IsDefer() bool
IsDefer define whether the service instantiate when first make or register
func (*NiceTestingEnvProvider) Name ¶
func (provider *NiceTestingEnvProvider) Name() string
Name / Name define the name for this service
func (*NiceTestingEnvProvider) Params ¶
func (provider *NiceTestingEnvProvider) Params(c framework.Container) []interface{}
Params define the necessary params for NewInstance
func (*NiceTestingEnvProvider) Register ¶
func (provider *NiceTestingEnvProvider) Register(c framework.Container) framework.NewInstance
Register registe a new function for make a service instance