env

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGinxEnv

func NewGinxEnv(params ...interface{}) (interface{}, error)

NewGinxEnv 有一个参数,.env文件所在的目录 example: NewGinxEnv("/envfolder/") 会读取文件: /envfolder/.env .env的文件格式 FOO_ENV=BAR

func NewGinxTestingEnv

func NewGinxTestingEnv(params ...interface{}) (interface{}, error)

NewGinxEnv 有一个参数,.env文件所在的目录 example: NewGinxEnv("/envfolder/") 会读取文件: /envfolder/.env .env的文件格式 FOO_ENV=BAR

Types

type GinxEnv

type GinxEnv struct {
	// contains filtered or unexported fields
}

GinxEnv 是 Env 的具体实现

func (*GinxEnv) All

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

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

func (*GinxEnv) AppEnv

func (en *GinxEnv) AppEnv() string

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

func (*GinxEnv) Get

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

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

func (*GinxEnv) IsExist

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

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

type GinxEnvProvider

type GinxEnvProvider struct {
	Folder string
}

func (*GinxEnvProvider) Boot

func (provider *GinxEnvProvider) Boot(c framework.Container) error

Boot will called when the service instantiate

func (*GinxEnvProvider) IsDefer

func (provider *GinxEnvProvider) IsDefer() bool

IsDefer define whether the service instantiate when first make or register

func (*GinxEnvProvider) Name

func (provider *GinxEnvProvider) Name() string

/ Name define the name for this service

func (*GinxEnvProvider) Params

func (provider *GinxEnvProvider) Params(c framework.Container) []interface{}

Params define the necessary params for NewInstance

func (*GinxEnvProvider) Register

Register registe a new function for make a service instance

type GinxTestingEnv

type GinxTestingEnv struct {
	// contains filtered or unexported fields
}

GinxEnv 是 Env 的具体实现

func (*GinxTestingEnv) All

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

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

func (*GinxTestingEnv) AppEnv

func (en *GinxTestingEnv) AppEnv() string

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

func (*GinxTestingEnv) Get

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

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

func (*GinxTestingEnv) IsExist

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

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

type GinxTestingEnvProvider

type GinxTestingEnvProvider struct {
	Folder string
}

func (*GinxTestingEnvProvider) Boot

func (provider *GinxTestingEnvProvider) Boot(c framework.Container) error

Boot will called when the service instantiate

func (*GinxTestingEnvProvider) IsDefer

func (provider *GinxTestingEnvProvider) IsDefer() bool

IsDefer define whether the service instantiate when first make or register

func (*GinxTestingEnvProvider) Name

func (provider *GinxTestingEnvProvider) Name() string

/ Name define the name for this service

func (*GinxTestingEnvProvider) Params

func (provider *GinxTestingEnvProvider) Params(c framework.Container) []interface{}

Params define the necessary params for NewInstance

func (*GinxTestingEnvProvider) Register

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