trace

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	Arguments          bool
	ExcludedOperations []sql.Operation
}

Options are the options for TraceHook.

func DefaultTraceHookOptions

func DefaultTraceHookOptions() Options

DefaultTraceHookOptions are the default options for TraceHook.

type TraceHook

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

TraceHook is a hook.Hook implementation for SQL tracing.

func NewTraceHook

func NewTraceHook(options ...TraceHookOption) *TraceHook

NewTraceHook returns a new TraceHook, for a provided list of TraceHookOption.

func (*TraceHook) After

func (h *TraceHook) After(ctx context.Context, event *sql.HookEvent)

After executes SQL tracing logic after SQL operations.

func (*TraceHook) Before

func (h *TraceHook) Before(ctx context.Context, event *sql.HookEvent) context.Context

Before executes SQL tracing logic before SQL operations.

type TraceHookOption

type TraceHookOption func(o *Options)

TraceHookOption are the functional options for TraceHook.

func WithArguments

func WithArguments(arguments bool) TraceHookOption

WithArguments is used to enable the SQL arguments tracing.

func WithExcludedOperations

func WithExcludedOperations(excludedOperations ...sql.Operation) TraceHookOption

WithExcludedOperations is used to exclude a list of database operations from tracing.

Jump to

Keyboard shortcuts

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