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