Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetModuleByName ¶ added in v0.3.1
GetModuleByName 使用泛型来获取模块
Types ¶
type ConfigOptions ¶ added in v0.3.2
type ConfigOptions struct { ConfigType string // 配置文件类型 ConfigPath string // 配置文件路径 ConfigSuffix string // 配置文件后缀 EnvValue env.EnvironmentType // 初始化环境 EnvContextKey env.ContextKey // 环境上下文Key UseEnvLevel EnvLevel // 使用环境级别,值为 "os" 或 "ctx" }
ConfigOptions 定义配置选项结构体
func GetDefaultConfigOptions ¶ added in v0.4.3
func GetDefaultConfigOptions() *ConfigOptions
GetDefaultConfigOptions 返回 ConfigOptions 的默认值
type MultiConfig ¶ added in v0.3.5
type MultiConfig struct { Server []register.Server `mapstructure:"server" yaml:"server" json:"server"` Cors []cors.Cors `mapstructure:"cors" yaml:"cors" json:"cors"` Consul []register.Consul `mapstructure:"consul" yaml:"consul" json:"consul"` Captcha []captcha.Captcha `mapstructure:"captcha" yaml:"captcha" json:"captcha"` MySQL []database.MySQL `mapstructure:"mysql" yaml:"mysql" json:"mysql"` PostgreSQL []database.PostgreSQL `mapstructure:"postgre" yaml:"postgre" json:"postgre"` SQLite []database.SQLite `mapstructure:"sqlite" yaml:"sqlite" json:"sqlite"` Redis []redis.Redis `mapstructure:"redis" yaml:"redis" json:"redis"` Email []email.Email `mapstructure:"email" yaml:"email" json:"email"` Ftp []ftp.Ftp `mapstructure:"ftp" yaml:"ftp" json:"ftp"` JWT []jwt.JWT `mapstructure:"jwt" yaml:"jwt" json:"jwt"` Minio []oss.Minio `mapstructure:"minio" yaml:"minio" json:"minio"` AliyunOss []oss.AliyunOss `mapstructure:"aliyunoss" yaml:"aliyunoss" json:"aliyunoss"` Mqtt []queue.Mqtt `mapstructure:"mqtt" yaml:"mqtt" json:"mqtt"` Zap []zap.Zap `mapstructure:"zap" yaml:"zap" json:"zap"` AliPay []pay.AliPay `mapstructure:"alipay" yaml:"alipay" json:"alipay"` WechatPay []pay.WechatPay `mapstructure:"wechatpay" yaml:"wechatpay" json:"wechatpay"` AliyunSms []sms.AliyunSms `mapstructure:"aliyunsms" yaml:"aliyunsms" json:"aliyunsms"` AliyunSts []sts.AliyunSts `mapstructure:"aliyunsts" yaml:"aliyunsts" json:"aliyunsts"` Youzan []youzan.YouZan `mapstructure:"youzan" yaml:"youzan" json:"youzan"` ZeroServer []zero.RpcServer `mapstructure:"zeroserver" yaml:"zeroserver" json:"zeroserver"` ZeroClient []zero.RpcClient `mapstructure:"zeroclient" yaml:"zeroclient" json:"zeroclient"` ZeroRestful []zero.Restful `mapstructure:"zerorestful" yaml:"zerorestful" json:"zerorestful"` Kafka []elk.Kafka `mapstructure:"kafka" yaml:"kafka" json:"kafka"` Elasticsearch []elk.Elasticsearch `mapstructure:"elasticsearch" yaml:"elasticsearch" json:"elasticsearch"` Jaeger []register.Jaeger `mapstructure:"jaeger" yaml:"jaeger" json:"jaeger"` Viper *viper.Viper `mapstructure:"-" yaml:"-" json:"-"` }
MultiConfig 多配置
type MultiConfigManager ¶ added in v0.4.2
type MultiConfigManager struct { MultiConfig *MultiConfig Options ConfigOptions }
MultiConfigManager 负责加载和管理 MultiConfig
func NewMultiConfigManager ¶ added in v0.4.2
func NewMultiConfigManager(ctx context.Context, options *ConfigOptions) (*MultiConfigManager, error)
NewMultiConfigManager 创建一个新的 MultiConfigManager
func (*MultiConfigManager) GetConfig ¶ added in v0.4.2
func (m *MultiConfigManager) GetConfig() *MultiConfig
GetConfig 获取 MultiConfig 配置
type SingleConfig ¶ added in v0.3.5
type SingleConfig struct { Server register.Server `mapstructure:"server" yaml:"server" json:"server"` Cors cors.Cors `mapstructure:"cors" yaml:"cors" json:"cors"` Consul register.Consul `mapstructure:"consul" yaml:"consul" json:"consul"` Captcha captcha.Captcha `mapstructure:"captcha" yaml:"captcha" json:"captcha"` MySQL database.MySQL `mapstructure:"mysql" yaml:"mysql" json:"mysql"` PostgreSQL database.PostgreSQL `mapstructure:"postgre" yaml:"postgre" json:"postgre"` SQLite database.SQLite `mapstructure:"sqlite" yaml:"sqlite" json:"sqlite"` Redis redis.Redis `mapstructure:"redis" yaml:"redis" json:"redis"` Email email.Email `mapstructure:"email" yaml:"email" json:"email"` Ftp ftp.Ftp `mapstructure:"ftp" yaml:"ftp" json:"ftp"` JWT jwt.JWT `mapstructure:"jwt" yaml:"jwt" json:"jwt"` Minio oss.Minio `mapstructure:"minio" yaml:"minio" json:"minio"` AliyunOss oss.AliyunOss `mapstructure:"aliyunoss" yaml:"aliyunoss" json:"aliyunoss"` Mqtt queue.Mqtt `mapstructure:"mqtt" yaml:"mqtt" json:"mqtt"` Zap zap.Zap `mapstructure:"zap" yaml:"zap" json:"zap"` AliPay pay.AliPay `mapstructure:"alipay" yaml:"alipay" json:"alipay"` WechatPay pay.WechatPay `mapstructure:"wechatpay" yaml:"wechatpay" json:"wechatpay"` AliyunSms sms.AliyunSms `mapstructure:"aliyunsms" yaml:"aliyunsms" json:"aliyunsms"` AliyunSts sts.AliyunSts `mapstructure:"aliyunsts" yaml:"aliyunsts" json:"aliyunsts"` Youzan youzan.YouZan `mapstructure:"youzan" yaml:"youzan" json:"youzan"` ZeroServer zero.RpcServer `mapstructure:"zeroserver" yaml:"zeroserver" json:"zeroserver"` ZeroClient zero.RpcClient `mapstructure:"zeroclient" yaml:"zeroclient" json:"zeroclient"` ZeroRestful zero.Restful `mapstructure:"zerorestful" yaml:"zerorestful" json:"zerorestful"` Kafka elk.Kafka `mapstructure:"kafka" yaml:"kafka" json:"kafka"` Elasticsearch elk.Elasticsearch `mapstructure:"elasticsearch" yaml:"elasticsearch" json:"elasticsearch"` Jaeger register.Jaeger `mapstructure:"jaeger" yaml:"jaeger" json:"jaeger"` Viper *viper.Viper `mapstructure:"-" yaml:"-" json:"-"` }
SingleConfig 单一配置
func GetSingleConfigByModuleName ¶ added in v0.4.0
func GetSingleConfigByModuleName(multiConfig MultiConfig, moduleName string) (*SingleConfig, error)
GetSingleConfigByModuleName 根据提供的模块名称从 MultiConfig 中获取对应的 SingleConfig
type SingleConfigManager ¶ added in v0.4.2
type SingleConfigManager struct { SingleConfig *SingleConfig Options ConfigOptions }
SingleConfigManager 负责加载和管理 SingleConfig
func NewSingleConfigManager ¶ added in v0.4.2
func NewSingleConfigManager(ctx context.Context, options *ConfigOptions) (*SingleConfigManager, error)
NewSingleConfigManager 创建一个新的 SingleConfigManager
func (*SingleConfigManager) GetConfig ¶ added in v0.4.2
func (m *SingleConfigManager) GetConfig() *SingleConfig
GetConfig 获取 SingleConfig 配置
Directories ¶
Path | Synopsis |
---|---|
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-07 23:55:15 * @FilePath: \go-config\internal\common.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
|
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-07 23:55:15 * @FilePath: \go-config\internal\common.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved. |
pkg
|
|
database
* @Author: kamalyes 501893067@qq.com * @Date: 2024-11-03 20:55:05 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-07 23:50:15 * @FilePath: \go-config\pkg\database\common.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
|
* @Author: kamalyes 501893067@qq.com * @Date: 2024-11-03 20:55:05 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-07 23:50:15 * @FilePath: \go-config\pkg\database\common.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved. |
elk
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-07 23:59:11 * @FilePath: \go-config\pkg\elk\es.go * @Description: * * Copyright (j) 2024 by kamalyes, All Rights Reserved.
|
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-07 23:59:11 * @FilePath: \go-config\pkg\elk\es.go * @Description: * * Copyright (j) 2024 by kamalyes, All Rights Reserved. |
env
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-07 16:11:10 * @FilePath: \go-config\pkg\env\env.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
|
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-07 16:11:10 * @FilePath: \go-config\pkg\env\env.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved. |
ftp
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-03 20:31:10 * @FilePath: \go-config\pkg\ftp\ftp.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
|
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-03 20:31:10 * @FilePath: \go-config\pkg\ftp\ftp.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved. |
sms
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-07 23:53:49 * @FilePath: \go-config\pkg\sms\aliyun.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
|
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-07 23:53:49 * @FilePath: \go-config\pkg\sms\aliyun.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved. |
zero
* @Author: kamalyes 501893067@qq.com * @Date: 2024-11-07 15:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-07 19:55:50 * @FilePath: \go-config\pkg\zero\etcd.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
|
* @Author: kamalyes 501893067@qq.com * @Date: 2024-11-07 15:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-07 19:55:50 * @FilePath: \go-config\pkg\zero\etcd.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved. |
Click to show internal directories.
Click to hide internal directories.