Documentation
¶
Index ¶
- Variables
- func AppendConfigFromAbsPath(fileName string)
- func AppendConfigFromRelativePath(fileName string)
- func AppendJsonFile(filePath string)
- func AppendPropertyFile(filePath string)
- func AppendYamlFile(filePath string)
- func ExistConfigFile() bool
- func GetConfigValue(c *gin.Context)
- func GetConfigValues(c *gin.Context)
- func GetValue(key string) any
- func GetValueArray(key string) []any
- func GetValueArrayInt(key string) []int
- func GetValueBool(key string) bool
- func GetValueBoolDefault(key string, defaultValue bool) bool
- func GetValueFloat32(key string) float32
- func GetValueFloat32Default(key string, defaultValue float32) float32
- func GetValueFloat64(key string) float64
- func GetValueFloat64Default(key string, defaultValue float64) float64
- func GetValueInt(key string) int
- func GetValueInt16(key string) int16
- func GetValueInt16Default(key string, defaultValue int16) int16
- func GetValueInt32(key string) int32
- func GetValueInt32Default(key string, defaultValue int32) int32
- func GetValueInt64(key string) int64
- func GetValueInt64Default(key string, defaultValue int64) int64
- func GetValueInt8(key string) int8
- func GetValueInt8Default(key string, defaultValue int8) int8
- func GetValueIntDefault(key string, defaultValue int) int
- func GetValueObject(key string, targetPtrObj any) error
- func GetValueString(key string) string
- func GetValueStringDefault(key, defaultValue string) string
- func GetValueUInt(key string) uint
- func GetValueUInt16(key string) uint16
- func GetValueUInt16Default(key string, defaultValue uint16) uint16
- func GetValueUInt32(key string) uint32
- func GetValueUInt32Default(key string, defaultValue uint32) uint32
- func GetValueUInt64(key string) uint64
- func GetValueUInt64Default(key string, defaultValue uint64) uint64
- func GetValueUInt8(key string) uint8
- func GetValueUInt8Default(key string, defaultValue uint8) uint8
- func GetValueUIntDefault(key string, defaultValue uint) uint
- func LoadConfig()
- func LoadConfigFromAbsPath(resourceAbsPath string)
- func LoadConfigFromRelativePath(resourceAbsPath string)
- func LoadJsonFile(filePath string)
- func LoadPropertyFile(filePath string)
- func LoadSpringConfig(AConfig any)
- func LoadYamlConfig(fileName string, AConfig any, handler func(data []byte, AConfig any) error) error
- func LoadYamlConfigByAbsolutPath(path string, AConfig any, handler func(data []byte, AConfig any) error) error
- func LoadYamlFile(filePath string)
- func SetValue(key string, value any)
- func UpdateConfig(c *gin.Context)
- type ApplicationProperty
- type BaseApi
- type BaseApplication
- type BaseConfig
- type BaseEndPoint
- type BaseException
- type BaseGin
- type BaseLogger
- type BaseProfile
- type BaseServer
- type EndPointConfig
- type EndPointHealth
- type EnvProperty
- type ExceptionPrint
- type LoggerColor
- type LoggerSplit
- type LoggerTime
- type StorageConnectionConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ApiModule string
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 ExistConfigFile ¶ added in v1.0.0
func ExistConfigFile() bool
func GetConfigValue ¶ added in v0.3.0
func GetConfigValues ¶ added in v0.3.0
func GetValueArray ¶ added in v1.0.0
func GetValueArrayInt ¶ added in v1.0.0
func GetValueBool ¶ added in v0.3.0
func GetValueBoolDefault ¶ added in v0.3.0
func GetValueFloat32 ¶ added in v0.3.0
func GetValueFloat32Default ¶ added in v0.3.0
func GetValueFloat64 ¶ added in v0.3.0
func GetValueFloat64Default ¶ added in v0.3.0
func GetValueInt ¶ added in v0.3.0
func GetValueInt16 ¶ added in v0.3.0
func GetValueInt16Default ¶ added in v0.3.0
func GetValueInt32 ¶ added in v0.3.0
func GetValueInt32Default ¶ added in v0.3.0
func GetValueInt64 ¶ added in v0.3.0
func GetValueInt64Default ¶ added in v0.3.0
func GetValueInt8 ¶ added in v0.3.0
func GetValueInt8Default ¶ added in v0.3.0
func GetValueIntDefault ¶ added in v0.3.0
func GetValueObject ¶ added in v0.3.0
func GetValueString ¶ added in v0.3.0
func GetValueStringDefault ¶ added in v0.3.0
func GetValueUInt ¶ added in v0.3.0
func GetValueUInt16 ¶ added in v0.3.0
func GetValueUInt16Default ¶ added in v0.3.0
func GetValueUInt32 ¶ added in v0.3.0
func GetValueUInt32Default ¶ added in v0.3.0
func GetValueUInt64 ¶ added in v0.3.0
func GetValueUInt64Default ¶ added in v0.3.0
func GetValueUInt8 ¶ added in v0.3.0
func GetValueUInt8Default ¶ added in v0.3.0
func GetValueUIntDefault ¶ added in v0.3.0
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 UpdateConfig ¶ added in v0.3.0
Types ¶
type ApplicationProperty ¶ added in v0.3.0
type BaseApplication ¶ added in v1.0.0
type BaseApplication struct {
Name string `yaml:"name"` // 应用名字
}
type BaseConfig ¶ added in v0.3.0
type BaseConfig struct { Api BaseApi `yaml:"api"` Application BaseApplication `yaml:"application"` Server BaseServer `yaml:"server"` EndPoint BaseEndPoint `yaml:"endpoint"` Logger BaseLogger `yaml:"logger"` Profiles BaseProfile `yaml:"profiles"` }
BaseConfig base前缀
var BaseCfg BaseConfig
type BaseEndPoint ¶ added in v1.0.0
type BaseEndPoint struct { Health EndPointHealth `yaml:"health"` // 健康检查[端点] Config EndPointConfig `yaml:"config"` // 配置管理[端点] }
type BaseException ¶ added in v1.0.0
type BaseException struct {
Print ExceptionPrint `yaml:"print"` // 异常返回打印
}
type BaseGin ¶ added in v1.0.0
type BaseGin struct {
Mode string `yaml:"mode"` // 有三种模式:debug/release/test
}
type BaseLogger ¶ added in v1.0.0
type BaseLogger struct { Level string `yaml:"level"` // 日志root级别:trace/debug/info/warn/error/fatal/panic,默认:info Time LoggerTime `yaml:"time"` // 时间配置 Color LoggerColor `yaml:"color"` // 日志颜色 Split LoggerSplit `yaml:"split"` // 日志切分 }
type BaseProfile ¶ added in v1.0.0
type BaseProfile struct {
Active string `yaml:"active"`
}
type BaseServer ¶ added in v1.0.0
type BaseServer struct { Enable bool `yaml:"enable"` // 是否启用 Port int `yaml:"port"` // 端口号 Gin BaseGin `yaml:"gin"` // web框架gin的配置 Exception BaseException `yaml:"exception"` // 异常处理 }
type EndPointConfig ¶ added in v1.0.0
type EndPointConfig struct {
Enable bool `yaml:"enable"` // 是否启用
}
type EndPointHealth ¶ added in v1.0.0
type EndPointHealth struct {
Enable bool `yaml:"enable"` // 是否启用
}
type EnvProperty ¶ added in v0.3.0
type ExceptionPrint ¶ added in v1.0.0
type LoggerColor ¶ added in v1.0.0
type LoggerColor struct {
Enable bool `yaml:"enable"` // 是否启用
}
type LoggerSplit ¶ added in v1.0.0
type LoggerTime ¶ added in v1.0.0
type LoggerTime struct {
Format string `yaml:"format"` // 时间格式,time包中的内容,比如:time.RFC3339
}
Click to show internal directories.
Click to hide internal directories.