store

package
v0.0.0-...-9cf7771 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitMockRedis

func InitMockRedis() *redis.Client

func InitRedis

func InitRedis(conf RedisConf) (*redis.Client, error)

Types

type DB

type DB struct {
	*sqlx.DB
}

func InitDB

func InitDB(driverName, dataSourceName string, driver driver.Driver, opt ...DatabaseOption) (*DB, error)

func InitMockMysql

func InitMockMysql(sqlDir string) (*DB, error)

func InitMysql

func InitMysql(conf MysqlConf, opt ...DatabaseOption) (*DB, error)

func (*DB) Transact

func (db *DB) Transact(fn func(*sqlx.Tx) error) (err error)

type DatabaseOption

type DatabaseOption struct {
	RegisterHookDriver bool
}

type Hooks

type Hooks struct{}

func (*Hooks) After

func (h *Hooks) After(ctx context.Context, query string, args ...interface{}) (context.Context, error)

func (*Hooks) Before

func (h *Hooks) Before(ctx context.Context, _ string, _ ...interface{}) (context.Context, error)

type MysqlConf

type MysqlConf struct {
	DataSourceName     string
	RegisterHookDriver bool
}

type RedisConf

type RedisConf struct {
	Addr               string
	Password           string
	DB                 int
	RegisterHookDriver bool
}

type RedisHook

type RedisHook struct{}

func (*RedisHook) AfterProcess

func (*RedisHook) AfterProcess(ctx context.Context, cmd redis.Cmder) error

func (*RedisHook) AfterProcessPipeline

func (*RedisHook) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error

func (*RedisHook) BeforeProcess

func (*RedisHook) BeforeProcess(ctx context.Context, _ redis.Cmder) (context.Context, error)

func (*RedisHook) BeforeProcessPipeline

func (*RedisHook) BeforeProcessPipeline(ctx context.Context, _ []redis.Cmder) (context.Context, error)

Jump to

Keyboard shortcuts

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