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
- type Config
- func (c *Config) GetGraphConfig() interface{}
- func (c *Config) GetKafkaConfig() interface{}
- func (c *Config) GetKvConfig() 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
- type EnvOption
- type EtcdOption
- type FileOption
- type SdkProvider
- type ViperConfig
- func (c *ViperConfig) Load(args ...string) *viper.Viper
- func (c *ViperConfig) SetFileBase(baseDir string) *ViperConfig
- func (c *ViperConfig) SetFileRoot(rootDir string) *ViperConfig
- func (c *ViperConfig) SetRemoteRoot(rootDir string) *ViperConfig
- func (c *ViperConfig) SetRemoteUrl(url string) *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 // 图数据库能力 )
View Source
var ( LogProvider = &SdkProvider{ Kind: types.SdkCategoryLog, Name: "log", Instance: &log.LoggerImpl{}, } )
Functions ¶
func Initialize ¶
Initialize 初始化SDK, 指定的配置文件里面有什么配置就配置什么能力
Types ¶
type Config ¶
type Config struct {
Sdk *types.SdkConfigItem `mapstructure:"sdk"`
}
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 struct { Env EnvOption // 环境变量选项 File FileOption // 配置文件选项 Etcd EtcdOption // etcd选项 }
type EtcdOption ¶
type FileOption ¶
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 string, args ...string) *ViperConfig
NewConfig args[0]为env
func (*ViperConfig) Load ¶ added in v1.0.11
func (c *ViperConfig) Load(args ...string) *viper.Viper
Load will load config from difference sources, the config will read with following precedence: - flag(命令行的设置是优先级最高的) - env(其次为环境变量) - config(再其次为配置文件) - key/value store(接着是KVStore(etcd)里面的设置) - default(最低的是默认配置)
func (*ViperConfig) SetFileBase ¶ added in v1.0.11
func (c *ViperConfig) SetFileBase(baseDir string) *ViperConfig
SetFileBase 设置配置文件的baseDir
func (*ViperConfig) SetFileRoot ¶ added in v1.0.11
func (c *ViperConfig) SetFileRoot(rootDir string) *ViperConfig
SetFileRoot 设置配置文件的rootDir
func (*ViperConfig) SetRemoteRoot ¶ added in v1.0.11
func (c *ViperConfig) SetRemoteRoot(rootDir string) *ViperConfig
SetRemoteRoot 设置etcd的root
func (*ViperConfig) SetRemoteUrl ¶ added in v1.0.11
func (c *ViperConfig) SetRemoteUrl(url string) *ViperConfig
SetRemoteUrl 设置远程provider的url
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 |
graph/neo4j
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 |
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.