zerobun

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BunInfoFieldName       = "bun_info"
	OperationFieldName     = "operation"
	OperationQueryName     = "query"
	OperationTimeFieldName = "operation_time_ms"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type QueryHook

type QueryHook struct {
	bun.QueryHook
	// contains filtered or unexported fields
}

func NewQueryHook

func NewQueryHook(options QueryHookOptions) QueryHook

NewQueryHook returns a new bun.QueryHook that outputs database transactions using an instance of zerolog.Logger

func (QueryHook) AfterQuery

func (qh QueryHook) AfterQuery(_ context.Context, event *bun.QueryEvent)

AfterQuery logs an entry after a database transaction

func (QueryHook) BeforeQuery

func (qh QueryHook) BeforeQuery(ctx context.Context, _ *bun.QueryEvent) context.Context

BeforeQuery called before a database transaction but currently does nothing

type QueryHookOptions

type QueryHookOptions struct {
	Logger       *zerolog.Logger
	SlowDuration time.Duration
}

Jump to

Keyboard shortcuts

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