Documentation ¶
Overview ¶
Package hdsdk 提供各类底层能力的直接访问方式,SDK包在使用前必须要初始化
首先必须创建一个继承自sdk.BaseConfig的配置struct e,g:
import hdget type XXXConfig struct { *sdk.Config `mapstructure:",squash"` }
Index ¶
- Variables
- func Initialize(configer types.Configer) error
- func UpdateRemoteConfig(v any) error
- type Config
- func (c *Config) GetEtcdConfig() interface{}
- func (c *Config) GetGraphConfig() interface{}
- func (c *Config) GetKafkaConfig() interface{}
- func (c *Config) GetLogConfig() interface{}
- func (c *Config) GetMysqlConfig() interface{}
- func (c *Config) GetNosqlConfig() interface{}
- func (c *Config) GetRabbitmqConfig() interface{}
- func (c *Config) GetRedisConfig() interface{}
- type ConfigOption
- func WithConfigDir(args ...string) ConfigOption
- func WithConfigFile(filepath string) ConfigOption
- func WithConfigFilename(filename string) ConfigOption
- func WithConfigType(configType string) ConfigOption
- func WithDisableRemoteEnvs(args ...string) ConfigOption
- func WithEnvPrefix(envPrefix string) ConfigOption
- func WithRemote(provider, url, path string) ConfigOption
- func WithRoot(args ...string) ConfigOption
- func WithWatch(enabled bool, effectDelay int) ConfigOption
- type OptionFile
- type OptionRemote
- type OptionWatch
- type SdkProvider
- type ViperConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Logger types.LogProvider // 日志能力 Mysql types.DbProvider // mysql数据库能力 Redis types.CacheProvider // redis缓存能力 Rabbitmq types.MqProvider // rabbitmq能力 Kafka types.MqProvider // kafka能力 Neo4j types.GraphProvider // 图数据库能力 Etcd types.KvProvider // kv能力 )
View Source
var ( LogProvider = &SdkProvider{ Kind: types.SdkCategoryLog, Name: "log", Instance: &log.LoggerImpl{}, } )
Functions ¶
func Initialize ¶
Initialize 初始化SDK, 指定的配置文件里面有什么配置就配置什么能力
func UpdateRemoteConfig ¶ added in v1.0.56
UpdateRemoteConfig 更新远程配置 nolint: staticcheck
Types ¶
type Config ¶
type Config struct {
Sdk *types.SdkConfigItem `mapstructure:"sdk"`
}
func (*Config) GetEtcdConfig ¶ added in v1.0.55
func (c *Config) GetEtcdConfig() interface{}
GetEtcdConfig 获取etcd配置
func (*Config) GetGraphConfig ¶
func (c *Config) GetGraphConfig() interface{}
GetGraphConfig 获取图数据库配置
func (*Config) GetKafkaConfig ¶
func (c *Config) GetKafkaConfig() interface{}
GetKafkaConfig 获取Kafka消息队列配置
func (*Config) GetMysqlConfig ¶
func (c *Config) GetMysqlConfig() interface{}
GetMysqlConfig 获取数据库配置
func (*Config) GetNosqlConfig ¶
func (c *Config) GetNosqlConfig() interface{}
GetNosqlConfig 获取非SQL配置
func (*Config) GetRabbitmqConfig ¶
func (c *Config) GetRabbitmqConfig() interface{}
GetRabbitmqConfig 获取消息队列配置
type ConfigOption ¶
type ConfigOption func(config *ViperConfig)
func WithConfigDir ¶ added in v1.0.55
func WithConfigDir(args ...string) ConfigOption
func WithConfigFile ¶ added in v1.0.55
func WithConfigFile(filepath string) ConfigOption
func WithConfigFilename ¶ added in v1.0.55
func WithConfigFilename(filename string) ConfigOption
func WithConfigType ¶ added in v1.0.55
func WithConfigType(configType string) ConfigOption
func WithDisableRemoteEnvs ¶ added in v1.0.55
func WithDisableRemoteEnvs(args ...string) ConfigOption
func WithEnvPrefix ¶ added in v1.0.55
func WithEnvPrefix(envPrefix string) ConfigOption
func WithRemote ¶ added in v1.0.55
func WithRemote(provider, url, path string) ConfigOption
func WithRoot ¶ added in v1.0.55
func WithRoot(args ...string) ConfigOption
func WithWatch ¶ added in v1.0.55
func WithWatch(enabled bool, effectDelay int) ConfigOption
type OptionFile ¶ added in v1.0.55
type OptionFile struct {
// contains filtered or unexported fields
}
type OptionRemote ¶ added in v1.0.55
type OptionRemote struct {
// contains filtered or unexported fields
}
type OptionWatch ¶ added in v1.0.55
type OptionWatch struct {
// contains filtered or unexported fields
}
type SdkProvider ¶
type SdkProvider struct { Kind types.SdkType // 底层能力类型 Name string // 底层能力名字 Instance types.Provider // 底层能力实现实例 }
SdkProvider 底层能力实例
type ViperConfig ¶ added in v1.0.11
type ViperConfig struct {
// contains filtered or unexported fields
}
ViperConfig 命令行配置
func NewConfig ¶ added in v1.0.11
func NewConfig(app, env string, options ...ConfigOption) *ViperConfig
NewConfig args[0]为env
func (*ViperConfig) Load ¶ added in v1.0.11
func (c *ViperConfig) Load(configVars ...any) error
func (*ViperConfig) LoadLocal ¶ added in v1.0.55
func (c *ViperConfig) LoadLocal(localConfigVar any) error
LoadLocal 从各个配置源获取配置数据, 并加载到configVar中, 同名变量配置高的覆盖低的 - remote: kvstore配置(低) - configFile: 文件配置(中) - env: 环境变量配置(高)
func (*ViperConfig) LoadRemote ¶ added in v1.0.55
func (c *ViperConfig) LoadRemote(remoteConfigVar any) error
func (*ViperConfig) Read ¶ added in v1.0.55
func (c *ViperConfig) Read(data []byte) *ViperConfig
func (*ViperConfig) ReadString ¶ added in v1.0.55
func (c *ViperConfig) ReadString(s string) *ViperConfig
Directories ¶
Path | Synopsis |
---|---|
lib
|
|
mbtree
Package mbtree 树结构相关方法
|
Package mbtree 树结构相关方法 |
provider
|
|
cache/redis
Package redis @Title log capability of zerolog @Description zerolog implementation of log capability @Author Ryan Fan 2021-06-09 @Update Ryan Fan 2021-06-09
|
Package redis @Title log capability of zerolog @Description zerolog implementation of log capability @Author Ryan Fan 2021-06-09 @Update Ryan Fan 2021-06-09 |
db/mysql
Package mysql @Title log capability of zerolog @Description zerolog implementation of log capability @Author Ryan Fan 2021-06-09 @Update Ryan Fan 2021-06-09
|
Package mysql @Title log capability of zerolog @Description zerolog implementation of log capability @Author Ryan Fan 2021-06-09 @Update Ryan Fan 2021-06-09 |
graph/neo4j
Package neo4j @Title log capability of zerolog @Description zerolog implementation of log capability @Author Ryan Fan 2021-06-09 @Update Ryan Fan 2021-06-09
|
Package neo4j @Title log capability of zerolog @Description zerolog implementation of log capability @Author Ryan Fan 2021-06-09 @Update Ryan Fan 2021-06-09 |
kv/etcd
Package etcd @Title log capability of zerolog @Description zerolog implementation of log capability @Author Ryan Fan 2021-06-09 @Update Ryan Fan 2021-06-09
|
Package etcd @Title log capability of zerolog @Description zerolog implementation of log capability @Author Ryan Fan 2021-06-09 @Update Ryan Fan 2021-06-09 |
log/zerolog
Package zerolog @Title log capability of zerolog @Description zerolog implementation of log capability @Author Ryan Fan 2021-06-09 @Update Ryan Fan 2021-06-09
|
Package zerolog @Title log capability of zerolog @Description zerolog implementation of log capability @Author Ryan Fan 2021-06-09 @Update Ryan Fan 2021-06-09 |
mq/kafka
Package kafka
|
Package kafka |
mq/kafkago
Package kafkago
|
Package kafkago |
mq/rabbitmq
Package rabbitmq
|
Package rabbitmq |
parallel
Package parallel 实现了可优雅关闭退出所有的actors Group
|
Package parallel 实现了可优雅关闭退出所有的actors Group |
Click to show internal directories.
Click to hide internal directories.