env

package
v0.0.0-...-fa5f906 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package env 提供一些环境变量相关的工具

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBool

func GetBool(key string) bool

GetBool 获取 bool 类型环境变量。大于零的值均会被视为 true, 字符串 true 和 TRUE 也会视为 true。 剩余情况 (包括不存在) 则返回 false

func GetInt

func GetInt[T constraints.Integer](key string, fallback T) T

GetInt 获取 int 类型环境变量, 如果环境变量不存在或非法则返回默认值

func GetString

func GetString(key string, fallback string) string

GetString 获取 string 类型环境变量, 如果环境变量不存在则返回默认值

func GetUint

func GetUint[T constraints.Unsigned](key string, fallback T) T

GetUint 获取 uint 类型环境变量, 如果环境变量不存在或非法则返回默认值

Types

This section is empty.

Jump to

Keyboard shortcuts

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