package module
v0.0.0-...-50192cd Latest Latest

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

Go to latest
Published: Mar 8, 2022 License: BSD-2-Clause Imports: 9 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Option

type Option func(*QueryHook)

func FromEnv

func FromEnv(key string) Option

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

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

func WithEnabled

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

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

func NewQueryHook

func NewQueryHook(opts ...Option) *QueryHook

func (*QueryHook) AfterQuery

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

func (*QueryHook) BeforeQuery

func (h *QueryHook) BeforeQuery(ctx context.Context, evt *ch.QueryEvent) context.Context

Jump to

Keyboard shortcuts

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