bundebug

package module
v1.2.18 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: BSD-2-Clause Imports: 9 Imported by: 338

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option added in v1.0.13

type Option func(*QueryHook)

func FromEnv added in v1.0.12

func FromEnv(keys ...string) Option

FromEnv configures the hook using the environment variable value. For example, WithEnv("BUNDEBUG"):

  • BUNDEBUG=0 - disables the hook.
  • BUNDEBUG=1 - enables the hook.
  • BUNDEBUG=2 - enables the hook and verbose mode.

func WithEnabled added in v1.0.12

func WithEnabled(on bool) Option

WithEnabled enables/disables the hook.

func WithVerbose

func WithVerbose(on bool) Option

WithVerbose configures the hook to log all queries (by default, only failed queries are logged).

func WithWriter added in v1.0.20

func WithWriter(w io.Writer) Option

WithWriter sets the log output to an io.Writer the default is os.Stderr

type QueryHook

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

QueryHook is a bun.QueryHook that logs executed queries to stderr.

func NewQueryHook

func NewQueryHook(opts ...Option) *QueryHook

NewQueryHook creates a new QueryHook with the given options.

func (*QueryHook) AfterQuery

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

func (*QueryHook) BeforeQuery

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

Jump to

Keyboard shortcuts

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