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