conf

package
v0.0.0-...-5d96014 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2021 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PublicAddr 公网(测试)
	PublicAddr = "acm.aliyun.com"
	// HZAddr 华东 1(杭州)
	HZAddr = "addr-hz-internal.edas.aliyun.com"
	// QDAddr 华北 1(青岛)
	QDAddr = "addr-qd-internal.edas.aliyun.com"
	// SHAddr 华东 2(上海)
	SHAddr = "addr-sh-internal.edas.aliyun.com"
	// BJAddr 华北 2(北京)
	BJAddr = "addr-bj-internal.edas.aliyun.com"
	// SZAddr 华南 1(深圳)
	SZAddr = "addr-sz-internal.edas.aliyun.com"
	// HKAddr 香港
	HKAddr = "addr-hk-internal.edas.aliyuncs.com"
	// SingaporeAddr 新加坡
	SingaporeAddr = "addr-singapore-internal.edas.aliyun.com"
	// ApAddr 澳大利亚(悉尼)
	ApAddr = "addr-ap-southeast-2-internal.edas.aliyun.com"
	// USWest1Addr 美国(硅谷)
	USWest1Addr = "addr-us-west-1-internal.acm.aliyun.com"
	// USEast1Addr 美国(弗吉尼亚)
	USEast1Addr = "addr-us-east-1-internal.acm.aliyun.com"
	// ShanghaiFinance1Addr 华东 2(上海)金融云
	ShanghaiFinance1Addr = "addr-cn-shanghai-finance-1-internal.edas.aliyun.com"
)

Variables

View Source
var (
	// Hostname 主机名 服务树-service_name-rnd
	Hostname = "localhost"
	// AppID service name
	AppID = "localapp"
	// Env dev/uat/pre/prod
	Env = "dev"
	// Zone 区域
	Zone = "sh001"
)

Functions

func Get

func Get(key string) string

Get 获取字符串配置

func GetBool

func GetBool(key string) bool

GetBool 获取配置布尔配置

func GetDuration

func GetDuration(key string) time.Duration

GetDuration 获取时间配置

func GetFloat64

func GetFloat64(key string) float64

GetFloat64 获取浮点数配置

func GetInt

func GetInt(key string) int

GetInt 获取整数配置

func GetInt32

func GetInt32(key string) int32

GetInt32 获取 int32 配置

func GetInt32s

func GetInt32s(key string) (s []int32, err error)

GetInt32s 获取数字列表 1,2,3 => []int32{1,2,3}

func GetInt64

func GetInt64(key string) int64

GetInt64 获取 int64 配置

func GetInt64s

func GetInt64s(key string) (s []int64, err error)

GetInt64s 获取数字列表

func GetStrings

func GetStrings(key string) (s []string)

GetStrings 获取字符串列表

func GetTime

func GetTime(key string, args ...string) time.Time

GetTime 查询时间配置 默认时间格式为 "2006-01-02 15:04:05",conf.GetTime("FOO_BEGIN") 如果需要指定时间格式,则可以多传一个参数,conf.GetString("FOO_BEGIN", "2006")

配置不存在或时间格式错误返回**空时间对象** 使用本地时区

func Set

func Set(key string, value string)

Set 设置配置,仅用于测试

Types

type Conf

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

Jump to

Keyboard shortcuts

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