Documentation
¶
Overview ¶
Package store mysql database
Package store redis database ¶
Package store redis hook for logging Redis commands ¶
Package store sql hooks
Index ¶
- func InitRedis(conf storeconf.RedisConfig) (*redis.Client, error)
- type DB
- type DatabaseOption
- type RedisHook
- func (*RedisHook) AfterProcess(ctx context.Context, cmd redis.Cmder) error
- func (*RedisHook) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error
- func (*RedisHook) BeforeProcess(ctx context.Context, _ redis.Cmder) (context.Context, error)
- func (*RedisHook) BeforeProcessPipeline(ctx context.Context, _ []redis.Cmder) (context.Context, error)
- type SQLHooks
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DB ¶
DB represents a database connection with sqlx capabilities.
func InitDB ¶
func InitDB(driverName, dataSourceName string, driver driver.Driver, opt ...DatabaseOption) (*DB, error)
InitDB initializes a database connection.
func InitMysql ¶
func InitMysql(conf storeconf.MysqlConfig, opt ...DatabaseOption) (*DB, error)
InitMysql initializes a MySQL connection.
type DatabaseOption ¶
type DatabaseOption struct {
Hook sqlhooks.Hooks
ConnMaxLifetime time.Duration
MaxIdleConns int
MaxOpenConns int
RegisterHookDriver bool
}
DatabaseOption defines options for initializing a database connection.
type RedisHook ¶
type RedisHook struct{}
RedisHook implements redis.Hook interface for logging Redis commands.
func (*RedisHook) AfterProcess ¶
AfterProcess is called after Redis command is processed.
func (*RedisHook) AfterProcessPipeline ¶
AfterProcessPipeline is called after a Redis pipeline is processed.
func (*RedisHook) BeforeProcess ¶
BeforeProcess is called before Redis command is processed.
Click to show internal directories.
Click to hide internal directories.