database

package
v0.0.0-...-bf86ce8 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMockDB

func GetMockDB() (*bun.DB, sqlmock.Sqlmock, error)

GetMockDB ... Get mock db connection for unit testing purpose

func InitDatabase

func InitDatabase(configInstance *config.Config, logger *zap.Logger) (*bun.DB, error)

InitDatabase ... initializes the database connection.

func PingDB

func PingDB(context context.Context, db *bun.DB, logger *zap.Logger) bool

PingDB ...

Types

type LoggerQueryHook

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

LoggerQueryHook implements logger that correspond to `bun.QueryHook` interface.

func NewLoggerQueryHook

func NewLoggerQueryHook(logger *zap.Logger) *LoggerQueryHook

NewLoggerQueryHook initializes a new `LoggerQueryHook`.

func (*LoggerQueryHook) AfterQuery

func (h *LoggerQueryHook) AfterQuery(ctx context.Context, event *bun.QueryEvent)

AfterQuery provides a hook to correspond to `bun.QueryHook` interface.

func (*LoggerQueryHook) BeforeQuery

func (h *LoggerQueryHook) BeforeQuery(ctx context.Context, event *bun.QueryEvent) context.Context

BeforeQuery provides a hook to correspond to `bun.QueryHook` interface.

Jump to

Keyboard shortcuts

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