env

package
v0.0.0-...-ed6a5cb Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewColonEnv

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

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

func NewColonTestingEnv

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

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

Types

type ColonEnv

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

ColonEnv 是 Env 的具体实现

func (*ColonEnv) All

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

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

func (*ColonEnv) AppEnv

func (en *ColonEnv) AppEnv() string

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

func (*ColonEnv) Get

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

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

func (*ColonEnv) IsExist

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

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

type ColonEnvProvider

type ColonEnvProvider struct {
	Folder string
}

func (*ColonEnvProvider) Boot

func (provider *ColonEnvProvider) Boot(c core.Container) error

Boot will called when the service instantiate

func (*ColonEnvProvider) IsDefer

func (provider *ColonEnvProvider) IsDefer() bool

IsDefer define whether the service instantiate when first make or register

func (*ColonEnvProvider) Name

func (provider *ColonEnvProvider) Name() string

/ Name define the name for this service

func (*ColonEnvProvider) Params

func (provider *ColonEnvProvider) Params(c core.Container) []interface{}

Params define the necessary params for NewInstance

func (*ColonEnvProvider) Register

func (provider *ColonEnvProvider) Register(c core.Container) core.NewInstance

Register registe a new function for make a service instance

type ColonTestingEnv

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

ColonEnv 是 Env 的具体实现

func (*ColonTestingEnv) All

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

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

func (*ColonTestingEnv) AppEnv

func (en *ColonTestingEnv) AppEnv() string

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

func (*ColonTestingEnv) Get

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

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

func (*ColonTestingEnv) IsExist

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

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

type ColonTestingEnvProvider

type ColonTestingEnvProvider struct {
	Folder string
}

func (*ColonTestingEnvProvider) Boot

func (provider *ColonTestingEnvProvider) Boot(c core.Container) error

Boot will called when the service instantiate

func (*ColonTestingEnvProvider) IsDefer

func (provider *ColonTestingEnvProvider) IsDefer() bool

IsDefer define whether the service instantiate when first make or register

func (*ColonTestingEnvProvider) Name

func (provider *ColonTestingEnvProvider) Name() string

/ Name define the name for this service

func (*ColonTestingEnvProvider) Params

func (provider *ColonTestingEnvProvider) Params(c core.Container) []interface{}

Params define the necessary params for NewInstance

func (*ColonTestingEnvProvider) Register

func (provider *ColonTestingEnvProvider) Register(c core.Container) core.NewInstance

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