Help us shape the future of Go! Take the 2026 Go Developer Survey

env

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPBEnv

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

func NewPBTestingEnv added in v1.0.0

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

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

Types

type PBEnv

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

PBEnv 是 Env 的具体实现

func (*PBEnv) All

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

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

func (*PBEnv) AppEnv

func (en *PBEnv) AppEnv() string

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

func (*PBEnv) Get

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

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

func (*PBEnv) IsExist

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

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

type PBEnvProvider

type PBEnvProvider struct {
	Folder string
}

func (*PBEnvProvider) Boot

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

Boot will called when the service instantiate

func (*PBEnvProvider) IsDefer

func (provider *PBEnvProvider) IsDefer() bool

IsDefer define whether the service instantiate when first make or register

func (*PBEnvProvider) Name

func (provider *PBEnvProvider) Name() string

/ Name define the name for this service

func (*PBEnvProvider) Params

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

Params define the necessary params for NewInstance

func (*PBEnvProvider) Register

func (provider *PBEnvProvider) Register(c framework.Container) framework.NewInstance

Register registe a new function for make a service instance

type PBTestingEnv added in v1.0.0

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

PBEnv 是 Env 的具体实现

func (*PBTestingEnv) All added in v1.0.0

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

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

func (*PBTestingEnv) AppEnv added in v1.0.0

func (en *PBTestingEnv) AppEnv() string

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

func (*PBTestingEnv) Get added in v1.0.0

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

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

func (*PBTestingEnv) IsExist added in v1.0.0

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

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

type PBTestingEnvProvider added in v1.0.0

type PBTestingEnvProvider struct {
	Folder string
}

func (*PBTestingEnvProvider) Boot added in v1.0.0

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

Boot will called when the service instantiate

func (*PBTestingEnvProvider) IsDefer added in v1.0.0

func (provider *PBTestingEnvProvider) IsDefer() bool

IsDefer define whether the service instantiate when first make or register

func (*PBTestingEnvProvider) Name added in v1.0.0

func (provider *PBTestingEnvProvider) Name() string

/ Name define the name for this service

func (*PBTestingEnvProvider) Params added in v1.0.0

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

Params define the necessary params for NewInstance

func (*PBTestingEnvProvider) Register added in v1.0.0

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