env

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCoreEnv

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

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

func NewGocoreTestingEnv added in v1.1.0

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

Types

type GocoreEnv

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

func (*GocoreEnv) All

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

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

func (*GocoreEnv) AppEnv

func (en *GocoreEnv) AppEnv() string

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

func (*GocoreEnv) Get

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

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

func (*GocoreEnv) IsExist

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

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

type GocoreEnvProvider

type GocoreEnvProvider struct {
	Folder string
}

func (*GocoreEnvProvider) Boot

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

func (*GocoreEnvProvider) IsDefer

func (provider *GocoreEnvProvider) IsDefer() bool

func (*GocoreEnvProvider) Name

func (provider *GocoreEnvProvider) Name() string

func (*GocoreEnvProvider) Params

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

func (*GocoreEnvProvider) Register

type GocoreTestingEnv added in v1.1.0

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

GocoreTestingEnv 是 Env 的具体实现

func (*GocoreTestingEnv) All added in v1.1.0

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

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

func (*GocoreTestingEnv) AppEnv added in v1.1.0

func (en *GocoreTestingEnv) AppEnv() string

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

func (*GocoreTestingEnv) Get added in v1.1.0

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

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

func (*GocoreTestingEnv) IsExist added in v1.1.0

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

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

type GocoreTestingEnvProvider added in v1.1.0

type GocoreTestingEnvProvider struct {
	Folder string
}

func (*GocoreTestingEnvProvider) Boot added in v1.1.0

Boot will called when the service instantiate

func (*GocoreTestingEnvProvider) IsDefer added in v1.1.0

func (provider *GocoreTestingEnvProvider) IsDefer() bool

IsDefer define whether the service instantiate when first make or register

func (*GocoreTestingEnvProvider) Name added in v1.1.0

func (provider *GocoreTestingEnvProvider) Name() string

Name define the name for this service

func (*GocoreTestingEnvProvider) Params added in v1.1.0

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

Params define the necessary params for NewInstance

func (*GocoreTestingEnvProvider) Register added in v1.1.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