chdebug

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: BSD-2-Clause Imports: 9 Imported by: 9

README

Logging executed queries with go-clickhouse

See documentation for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*QueryHook)

func FromEnv

func FromEnv(keys ...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