Help us shape the future of Go! Take the 2026 Go Developer Survey

query

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Strip

func Strip(s string) string

Types

type Filled

type Filled struct {
	*Named
	Args []any
}

Filled prints the query with summarized parametrized arg values when stringed.

func (*Filled) QueryString

func (f *Filled) QueryString() string

func (*Filled) String

func (f *Filled) String() string

type Named

type Named struct {
	Name  string
	Query string
}

Named is a named SQL query string that formats nicely when stringed. The name should be used for tracking in metrics, and printed in error logs.

func New

func New(query, param string, numbered bool, name string) *Named

New returns a new named query, and handles replacing `?` parameters with whatever parameter characters the driver requires.

func (*Named) Appendf

func (n *Named) Appendf(format string, a ...any) *Named

Append returns a copy of the named query, with additional text appended to the query string.

func (*Named) Fill

func (n *Named) Fill(args []any) *Filled

Fill returns an instance of the query filled with the given args.

func (*Named) String

func (n *Named) String() string

String nicely formats the query and name for printing in logs.

type Stmt

type Stmt struct {
	*Named
	Stmt *sql.Stmt
}

Stmt is a wrapper around sql.Stmt that remembers what query it was prepared from

func (*Stmt) Close

func (s *Stmt) Close() error

Jump to

Keyboard shortcuts

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