env

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 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 有一个参数,代表当前是否为测试环境

Types

type YgoEnv

type YgoEnv struct {
	contract.Env

	IsTest bool // 代表是否为本地测试环境
	// 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 {
	IsTest bool
}

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

Jump to

Keyboard shortcuts

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