conn

package
v1.1.44 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDB

func GetDB(ctx context.Context) (*gorm.DB, bool)

GetDB 获取数据库连接

func InitJaegerTracer

func InitJaegerTracer(serviceName, url string) error

InitJaegerTracer 设置全局trace

func NewDiscovery

NewDiscovery 创建一个服务发现实例

func NewGormDB

func NewGormDB(c GormDBConfig, logger ...log.Logger) (*gorm.DB, error)

NewGormDB 获取数据库连接

func NewGormLogger added in v1.1.0

func NewGormLogger(logger log.Logger) logger.Interface

NewGormLogger Gorm日志实现

func NewNutsDB added in v1.0.2

func NewNutsDB(cfg NutsDbConfig) (*nutsdb.DB, error)

NewNutsDB 创建一个 nuts db

func NewRedisClient

func NewRedisClient(cfg RedisConfig) *redis.Client

NewRedisClient 获取redis客户端

func NewRegister

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

type GormDBConfig interface {
	GetDriver() string
	GetDsn() string
	GetDebug() bool
}

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 设置日志等级

func (*GormLogger) Trace added in v1.1.0

func (l *GormLogger) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error)

Trace log trace

func (*GormLogger) Warn added in v1.1.0

func (l *GormLogger) Warn(ctx context.Context, s string, i ...interface{})

Warn log warn

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

type NutsDbConfig interface {
	GetPath() string
	GetBucket() string
}

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配置

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL