package module
Version: v0.3.1 Latest Latest

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: 3


Logging executed queries with go-clickhouse

See documentation for details.




This section is empty.


This section is empty.


This section is empty.


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

Source Files

Jump to

Keyboard shortcuts

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