Documentation ¶
Index ¶
- func GetDB(ctx context.Context) (*gorm.DB, bool)
- func InitJaegerTracer(serviceName, url string) error
- func NewDiscovery(c IDiscoveryConfig, opts ...DiscoveryConfigBuilderOptions) (registry.Discovery, error)
- func NewGormDB(c GormDBConfig, logger ...log.Logger) (*gorm.DB, error)
- func NewNutsDB(cfg NutsDbConfig) (*nutsdb.DB, error)
- func NewRedisClient(cfg RedisConfig) *redis.Client
- func NewRegister(c IDiscoveryConfig, opts ...DiscoveryConfigBuilderOptions) (registry.Registrar, error)
- type DiscoveryConfigBuilderOptions
- type GormDBConfig
- type IDiscoveryConfig
- type IEtcdConfig
- type NutsDbConfig
- type RedisConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitJaegerTracer ¶
InitJaegerTracer 设置全局trace
func NewDiscovery ¶
func NewDiscovery(c IDiscoveryConfig, opts ...DiscoveryConfigBuilderOptions) (registry.Discovery, error)
NewDiscovery 创建一个服务发现实例
func NewNutsDB ¶ added in v1.0.2
func NewNutsDB(cfg NutsDbConfig) (*nutsdb.DB, error)
NewNutsDB 创建一个 nuts db
func NewRegister ¶
func NewRegister(c IDiscoveryConfig, opts ...DiscoveryConfigBuilderOptions) (registry.Registrar, error)
NewRegister 创建一个服务注册实例
Types ¶
type DiscoveryConfigBuilderOptions ¶ added in v1.0.2
type DiscoveryConfigBuilderOptions func(cfg *discoveryConfig)
DiscoveryConfigBuilderOptions 服务发现配置构建选项
func WithDiscoveryConfigEtcd ¶ added in v1.0.2
func WithDiscoveryConfigEtcd(etcdConf IEtcdConfig) DiscoveryConfigBuilderOptions
type GormDBConfig ¶
GormDBConfig GORM数据库配置
type IDiscoveryConfig ¶ added in v1.0.2
type IDiscoveryConfig interface {
GetType() string
}
IDiscoveryConfig 服务发现配置
type IEtcdConfig ¶ added in v1.0.2
type IEtcdConfig interface { GetEndpoints() []string GetPassword() string GetTimeout() *durationpb.Duration GetUsername() string }
IEtcdConfig etcd配置
type NutsDbConfig ¶ added in v1.0.2
NutsDbConfig nuts db 配置
type RedisConfig ¶
type RedisConfig interface { GetNetwork() string GetAddr() string GetPassword() string GetDb() uint32 GetWriteTimeout() *durationpb.Duration GetReadTimeout() *durationpb.Duration GetDialTimeout() *durationpb.Duration }
RedisConfig redis配置
Click to show internal directories.
Click to hide internal directories.