config

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: Apache-2.0 Imports: 12 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendConfigFromAbsPath added in v0.3.0

func AppendConfigFromAbsPath(fileName string)

AppendConfigFromAbsPath 追加配置:绝对路径的配置文件

func AppendConfigFromRelativePath added in v0.3.0

func AppendConfigFromRelativePath(fileName string)

AppendConfigFromRelativePath 追加配置:相对路径的配置文件

func AppendJsonFile added in v0.3.0

func AppendJsonFile(filePath string)

func AppendPropertyFile added in v0.3.0

func AppendPropertyFile(filePath string)

func AppendYamlFile added in v0.3.0

func AppendYamlFile(filePath string)

func GetConfigValue added in v0.3.0

func GetConfigValue(c *gin.Context)

func GetConfigValues added in v0.3.0

func GetConfigValues(c *gin.Context)

func GetValue added in v0.3.0

func GetValue(key string) interface{}

func GetValueBool added in v0.3.0

func GetValueBool(key string) bool

func GetValueBoolDefault added in v0.3.0

func GetValueBoolDefault(key string, defaultValue bool) bool

func GetValueFloat32 added in v0.3.0

func GetValueFloat32(key string) float32

func GetValueFloat32Default added in v0.3.0

func GetValueFloat32Default(key string, defaultValue float32) float32

func GetValueFloat64 added in v0.3.0

func GetValueFloat64(key string) float64

func GetValueFloat64Default added in v0.3.0

func GetValueFloat64Default(key string, defaultValue float64) float64

func GetValueInt added in v0.3.0

func GetValueInt(key string) int

func GetValueInt16 added in v0.3.0

func GetValueInt16(key string) int16

func GetValueInt16Default added in v0.3.0

func GetValueInt16Default(key string, defaultValue int16) int16

func GetValueInt32 added in v0.3.0

func GetValueInt32(key string) int32

func GetValueInt32Default added in v0.3.0

func GetValueInt32Default(key string, defaultValue int32) int32

func GetValueInt64 added in v0.3.0

func GetValueInt64(key string) int64

func GetValueInt64Default added in v0.3.0

func GetValueInt64Default(key string, defaultValue int64) int64

func GetValueInt8 added in v0.3.0

func GetValueInt8(key string) int8

func GetValueInt8Default added in v0.3.0

func GetValueInt8Default(key string, defaultValue int8) int8

func GetValueIntDefault added in v0.3.0

func GetValueIntDefault(key string, defaultValue int) int

func GetValueObject added in v0.3.0

func GetValueObject(key string, targetPtrObj interface{}) error

func GetValueString added in v0.3.0

func GetValueString(key string) string

func GetValueStringDefault added in v0.3.0

func GetValueStringDefault(key, defaultValue string) string

func GetValueUInt added in v0.3.0

func GetValueUInt(key string) uint

func GetValueUInt16 added in v0.3.0

func GetValueUInt16(key string) uint16

func GetValueUInt16Default added in v0.3.0

func GetValueUInt16Default(key string, defaultValue uint16) uint16

func GetValueUInt32 added in v0.3.0

func GetValueUInt32(key string) uint32

func GetValueUInt32Default added in v0.3.0

func GetValueUInt32Default(key string, defaultValue uint32) uint32

func GetValueUInt64 added in v0.3.0

func GetValueUInt64(key string) uint64

func GetValueUInt64Default added in v0.3.0

func GetValueUInt64Default(key string, defaultValue uint64) uint64

func GetValueUInt8 added in v0.3.0

func GetValueUInt8(key string) uint8

func GetValueUInt8Default added in v0.3.0

func GetValueUInt8Default(key string, defaultValue uint8) uint8

func GetValueUIntDefault added in v0.3.0

func GetValueUIntDefault(key string, defaultValue uint) uint

func LoadConfig

func LoadConfig()

func LoadConfigFromAbsPath added in v0.3.0

func LoadConfigFromAbsPath(resourceAbsPath string)

LoadConfigFromAbsPath 加载绝对文件路径

func LoadConfigFromRelativePath added in v0.3.0

func LoadConfigFromRelativePath(resourceAbsPath string)

LoadConfigFromRelativePath 加载相对文件路径

func LoadJsonFile added in v0.3.0

func LoadJsonFile(filePath string)

func LoadPropertyFile added in v0.3.0

func LoadPropertyFile(filePath string)

func LoadSpringConfig added in v0.3.0

func LoadSpringConfig(AConfig any)

func LoadYamlConfig added in v0.3.0

func LoadYamlConfig(fileName string, AConfig any, handler func(data []byte, AConfig any) error) error

LoadYamlConfig read fileName from private path fileName,eg:application.yml, and transform it to AConfig note: AConfig must be a pointer

func LoadYamlConfigByAbsolutPath added in v0.3.0

func LoadYamlConfigByAbsolutPath(path string, AConfig any, handler func(data []byte, AConfig any) error) error

LoadYamlConfigByAbsolutPath read fileName from absolute path fileName,eg:/home/isc-gobase/application.yml, and transform it to AConfig note: AConfig must be a pointer

func LoadYamlFile added in v0.3.0

func LoadYamlFile(filePath string)

func SetValue added in v0.3.0

func SetValue(key string, value interface{})

func UpdateConfig added in v0.3.0

func UpdateConfig(c *gin.Context)

Types

type AppApplication

type AppApplication struct {
	Name string
}

type AppProfile

type AppProfile struct {
	Active string
}

type ApplicationProperty added in v0.3.0

type ApplicationProperty struct {
	ValueMap     map[string]interface{}
	ValueDeepMap map[string]interface{}
}

type BaseConfig added in v0.3.0

type BaseConfig struct {
	Application AppApplication
	Profiles    AppProfile
}

BaseConfig base前缀

var BaseCfg BaseConfig

type EnvProperty added in v0.3.0

type EnvProperty struct {
	Key   string
	Value string
}

type LoggerConfig added in v0.3.0

type LoggerConfig struct {
	Level string
	Path  string
}

LoggerConfig log 前缀

var LogCfg LoggerConfig

type ServerConfig added in v0.3.0

type ServerConfig struct {
	Port   int
	Lookup bool
}

ServerConfig server前缀

var ServerCfg ServerConfig

type StorageConnectionConfig added in v0.3.0

type StorageConnectionConfig struct {
	Host       string
	Port       int
	User       string
	Password   string
	Parameters string
}

Jump to

Keyboard shortcuts

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