env

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Env

func Env() string

Env 获取服务环境

func ID

func ID() string

ID 获取服务ID

func IsDev

func IsDev() bool

IsDev 是否是开发环境

func IsEnv

func IsEnv(e string) bool

IsEnv 是否是指定环境

func IsLocal

func IsLocal() bool

IsLocal 是否是本地环境

func IsProd

func IsProd() bool

IsProd 是否是生产环境

func IsTest

func IsTest() bool

IsTest 是否是测试环境

func Metadata

func Metadata() map[string]string

Metadata 获取服务元数据

func Name

func Name() string

Name 获取服务名称

func SetEnv

func SetEnv(e string)

SetEnv 设置服务环境变量

func SetMetadata

func SetMetadata(m map[string]string)

SetMetadata 设置服务元数据

func SetName

func SetName(n string)

SetName 设置服务名称

func SetVersion

func SetVersion(v string)

SetVersion 设置服务版本

func Version

func Version() string

Version 获取服务版本

Types

type Type

type Type string

Type 运行环境类型

const (
	// Local 本地环境
	Local Type = "local"
	// Dev  开发环境
	Dev Type = "dev"
	// Test 测试环境
	Test Type = "test"
	// Prod 生产环境
	Prod Type = "prod"
)

Jump to

Keyboard shortcuts

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