component

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: MulanPSL-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// common
	PrintfDSN = true

	// mysql
	MysqlSlowThreshold = 300

	// reids
	RedisIdleCheckTime,
	RedisMaxReadTime,
	RedisMaxWriteTime,
	RedisMaxRequestTime,
	RedisSlowThreshold int

	// mongo
	MongoMinPoolSize,
	MongoMaxPoolSize,
	MongoReqMaxTime,
	MongoSelectionTime,
	MongoMaxIdleTime,
	MongoSlowThreshold int

	// es
	EsSlowThreshold,
	EsMaxConnTime,
	EsMaxIdleTime,
	EsMaxRepTime,
	EsKeepAliveTime int
)

Functions

This section is empty.

Types

type ElasticSearch

type ElasticSearch struct {
	Name string
	Cfg  *config.EntityEs
	DB   *elasticsearch.Client
}

func (*ElasticSearch) CliFlags

func (c *ElasticSearch) CliFlags() []cli.Flag

func (*ElasticSearch) Close

func (c *ElasticSearch) Close() error

func (*ElasticSearch) Init

func (c *ElasticSearch) Init(l logger.Interface, cfg *gsf.AppConfig, ctx *cli.Context) error

func (*ElasticSearch) Run

func (c *ElasticSearch) Run() (err error)

type Mongo

type Mongo struct {
	Name string
	Cfg  *config.EntityMongo
	DB   *mongo.Database
}

func (*Mongo) CliFlags

func (c *Mongo) CliFlags() []cli.Flag

func (*Mongo) Close

func (c *Mongo) Close() error

func (*Mongo) Init

func (c *Mongo) Init(l logger.Interface, cfg *gsf.AppConfig, ctx *cli.Context) error

func (*Mongo) Run

func (c *Mongo) Run() error

type MySQL

type MySQL struct {
	Name string
	DB   *gorm.DB
	Log  MysqlLogger
	Cfg  *config.EntityMysql
}

func (*MySQL) CliFlags

func (c *MySQL) CliFlags() []cli.Flag

func (*MySQL) Close

func (c *MySQL) Close() error

func (*MySQL) Init

func (c *MySQL) Init(l glogger.Interface, cfg *gsf.AppConfig, _ *cli.Context) error

func (*MySQL) Run

func (c *MySQL) Run() error

func (*MySQL) SetLogLevel

func (c *MySQL) SetLogLevel(v int)

type MysqlLogger

type MysqlLogger struct {
	// contains filtered or unexported fields
}

func (*MysqlLogger) Error

func (l *MysqlLogger) Error(_ context.Context, msg string, data ...interface{})

func (*MysqlLogger) Info

func (l *MysqlLogger) Info(_ context.Context, msg string, data ...interface{})

func (*MysqlLogger) LogMode

func (l *MysqlLogger) LogMode(level logger.LogLevel) logger.Interface

func (*MysqlLogger) SetLogger

func (l *MysqlLogger) SetLogger(log glogger.Interface)

func (*MysqlLogger) Trace

func (l *MysqlLogger) Trace(_ context.Context, begin time.Time, fc func() (string, int64), err error)

func (*MysqlLogger) Warn

func (l *MysqlLogger) Warn(_ context.Context, msg string, data ...interface{})

type Redis

type Redis struct {
	Name string
	Cfg  *config.EntityRedis
	DB   *redis.Client
}

func (*Redis) CliFlags

func (c *Redis) CliFlags() []cli.Flag

func (*Redis) Close

func (c *Redis) Close() error

func (*Redis) Init

func (c *Redis) Init(l logger.Interface, cfg *gsf.AppConfig, _ *cli.Context) error

func (*Redis) Run

func (c *Redis) Run() error

Jump to

Keyboard shortcuts

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