env

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

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 YgoEnv

type YgoEnv struct {
	contract.Env
	// contains filtered or unexported fields
}

YgoEnv 是 Env 的具体实现

func (*YgoEnv) All

func (en *YgoEnv) All() map[string]string

All 获取所有的环境变量,.env和运行环境变量融合后结果

func (*YgoEnv) AppEnv

func (en *YgoEnv) AppEnv() string

AppEnv 获取表示当前APP环境的变量APP_ENV

func (*YgoEnv) Get

func (en *YgoEnv) Get(key string) string

Get 获取某个环境变量,如果没有设置,返回""

func (*YgoEnv) IsExist

func (en *YgoEnv) IsExist(key string) bool

IsExist 判断一个环境变量是否有被设置

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

type YgoTestingEnv struct {
	contract.Env
	// contains filtered or unexported fields
}

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

Register registe a new function for make a service instance

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL