hooktest

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: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TestHookEventQuery    = "SELECT * FROM foo WHERE id = ?"
	TestHookEventArgument = "42"
)

Functions

func NewTestHookEvent

func NewTestHookEvent(options ...TestHookEventOption) *sql.HookEvent

NewTestHookEvent returns a new sql.HookEvent for tests purposes.

Types

type Options

type Options struct {
	System    sql.System
	Operation sql.Operation
	Query     string
	Arguments any
}

Options are the options for NewTestHookEvent.

func DefaultTestHookEventOptions

func DefaultTestHookEventOptions() Options

DefaultTestHookEventOptions are the default options for NewTestHookEvent.

type TestHookEventOption

type TestHookEventOption func(o *Options)

TestHookEventOption are the functional options for NewTestHookEvent.

func WithArguments

func WithArguments(arguments any) TestHookEventOption

WithArguments is used to set the arguments of the test sql.HookEvent.

func WithOperation

func WithOperation(operation sql.Operation) TestHookEventOption

WithOperation is used to set the sql.Operation of the test sql.HookEvent.

func WithQuery

func WithQuery(query string) TestHookEventOption

WithQuery is used to set the query of the test sql.HookEvent.

func WithSystem

func WithSystem(system sql.System) TestHookEventOption

WithSystem is used to set the sql.System of the test sql.HookEvent.

Jump to

Keyboard shortcuts

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