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 LoadConfig(app, cliEnv, cliFile string, args ...ConfigOption) *viper.Viper
- type Config
- func (c *Config) GetKafkaConfig() interface{}
- func (c *Config) GetKvConfig() interface{}
- func (c *Config) GetLogConfig() interface{}
- func (c *Config) GetMicroServiceConfig() interface{}
- func (c *Config) GetMysqlConfig() interface{}
- func (c *Config) GetNosqlConfig() interface{}
- func (c *Config) GetRabbitmqConfig() interface{}
- func (c *Config) GetRedisConfig() interface{}
- type ConfigOption
- type EnvOption
- type EtcdOption
- type FileOption
- type SdkProvider
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能力 MicroService types.MsProvider // 微服务能力 )
View Source
var ( LogProvider = &SdkProvider{ Kind: types.SdkCategoryLog, Name: "log", Instance: &log.LoggerImpl{}, } )
Functions ¶
func Initialize ¶
Initialize 初始化SDK, 指定的配置文件里面有什么配置就配置什么能力
func LoadConfig ¶
func LoadConfig(app, cliEnv, cliFile string, args ...ConfigOption) *viper.Viper
LoadConfig It will will load config from difference sources, the config will read with following precedence: - flag(命令行的设置是优先级最高的) - env(其次为环境变量) - config(再其次为配置文件) - key/value store(接着是KVStore(etcd)里面的设置) - default(最低的是默认配置)
Types ¶
type Config ¶
type Config struct {
Sdk *types.SdkConfigItem `mapstructure:"sdk"`
}
func (*Config) GetKafkaConfig ¶
func (c *Config) GetKafkaConfig() interface{}
GetKafkaConfig 获取Kafka消息队列配置
func (*Config) GetMicroServiceConfig ¶
func (c *Config) GetMicroServiceConfig() interface{}
GetMicroServiceConfig 获取Gokit微服务配置
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 struct { Env EnvOption // 环境变量选项 File FileOption // 配置文件选项 Etcd EtcdOption // etcd选项 }
配置加载选项
type EtcdOption ¶
type EtcdOption struct {
Url string
}
type FileOption ¶
Directories ¶
Path | Synopsis |
---|---|
lib
|
|
mbtree
Package mbtree 树结构相关方法
|
Package mbtree 树结构相关方法 |
provider
|
|
cache/redis
@Title log capability of zerolog @Description zerolog implementation of log capability @Author Ryan Fan 2021-06-09 @Update Ryan Fan 2021-06-09
|
@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 |
log/zerolog
@Title log capability of zerolog @Description zerolog implementation of log capability @Author Ryan Fan 2021-06-09 @Update Ryan Fan 2021-06-09
|
@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 @Title log capability of zerolog @Description zerolog implementation of log capability @Author Ryan Fan 2021-06-09 @Update Ryan Fan 2021-06-09
|
Package kafka Package kafka @Title log capability of zerolog @Description zerolog implementation of log capability @Author Ryan Fan 2021-06-09 @Update Ryan Fan 2021-06-09 |
mq/kafkago
Package kafkago Package kafkago @Title log capability of zerolog @Description zerolog implementation of log capability @Author Ryan Fan 2021-06-09 @Update Ryan Fan 2021-06-09
|
Package kafkago Package kafkago @Title log capability of zerolog @Description zerolog implementation of log capability @Author Ryan Fan 2021-06-09 @Update Ryan Fan 2021-06-09 |
mq/rabbitmq
Package rabbitmq 1.
|
Package rabbitmq 1. |
ms
Package ms provides microservice ability
|
Package ms provides microservice ability |
ms/gokit
Package gokit Package gokit microservice implemented by gokit @Author Ryan Fan 2021-07-27 @Update Ryan Fan 2021-07-27
|
Package gokit Package gokit microservice implemented by gokit @Author Ryan Fan 2021-07-27 @Update Ryan Fan 2021-07-27 |
parallel
Package parallel 实现了可优雅关闭退出所有的actors Group | ---> 执行actor | ---> 退出处理 其类似errgroup, 但其不要求actor goroutines去理解上下文的意思,这样它可以在更多的场景下使用.
|
Package parallel 实现了可优雅关闭退出所有的actors Group | ---> 执行actor | ---> 退出处理 其类似errgroup, 但其不要求actor goroutines去理解上下文的意思,这样它可以在更多的场景下使用. |
Click to show internal directories.
Click to hide internal directories.