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 NewGormLogger(logger log.Logger) logger.Interface
- 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 GormLogger
- func (l *GormLogger) Error(ctx context.Context, s string, i ...interface{})
- func (l *GormLogger) Info(ctx context.Context, s string, i ...interface{})
- func (l *GormLogger) LogMode(level logger.LogLevel) logger.Interface
- func (l *GormLogger) Trace(ctx context.Context, begin time.Time, ...)
- func (l *GormLogger) Warn(ctx context.Context, s string, i ...interface{})
- 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 NewGormLogger ¶ added in v1.1.0
NewGormLogger Gorm日志实现
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
WithDiscoveryConfigEtcd 设置 etcd 配置
type GormDBConfig ¶
GormDBConfig GORM数据库配置
type GormLogger ¶ added in v1.1.0
type GormLogger struct {
// contains filtered or unexported fields
}
GormLogger gorm日志实现
func (*GormLogger) Error ¶ added in v1.1.0
func (l *GormLogger) Error(ctx context.Context, s string, i ...interface{})
Error log error
func (*GormLogger) Info ¶ added in v1.1.0
func (l *GormLogger) Info(ctx context.Context, s string, i ...interface{})
Info log info
func (*GormLogger) LogMode ¶ added in v1.1.0
func (l *GormLogger) LogMode(level logger.LogLevel) logger.Interface
LogMode 设置日志等级
type IDiscoveryConfig ¶ added in v1.0.2
type IDiscoveryConfig interface {
GetDriver() 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.