env

package
v0.0.0-...-b3f7bda Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All() []string

All

@Description:获取环境变量
@return []string

func Contains

func Contains(key string) bool

Contains

@Description: 判断环境变量key是否存在,存在返回true
@param key
@return bool

func Get

func Get(key string, def ...interface{}) interface{}

Get

@Description: 获取指定key的环境变量值,如果不存在且def存在返回第一个def,如果key和def都不存在返回nil
@param key 环境变量key
@param def 默认值
@return interface{}

func Map

func Map() map[string]string

Map

@Description: 获取环境变量map
@return map[string]string

func Remove

func Remove(key ...string) (err error)

Remove

@Description: 从环境变量中移除key
@param key
@return err

func Set

func Set(key, value string) (err error)

Set

@Description: 设置环境变量,仅在当前进程有效
@param key
@param value
@return err

func SetMap

func SetMap(m map[string]string) (err error)

SetMap

@Description: 设置环境变量,仅在当前进程有效
@param m
@return err

Types

This section is empty.

Jump to

Keyboard shortcuts

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