sanitize

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QuoteBytes

func QuoteBytes(buf []byte) string

func QuoteString

func QuoteString(str string) string

func SanitizeSQL

func SanitizeSQL(cmd string, args ...any) (string, error)

SanitizeSQL replaces placeholder values with args. It quotes and escapes args as necessary. This function is only safe when standard_conforming_strings is on.

Types

type Command

type Command struct {
	Parts []Part
}

func NewQuery

func NewQuery(sql string) (*Command, error)

func (*Command) Sanitize

func (q *Command) Sanitize(args ...any) (string, error)

type Part

type Part any

Part is either a string or an int. A string is raw SQL. An int is a argument placeholder.

Jump to

Keyboard shortcuts

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