package sanitize

import "github.com/jackc/pgx/v5/internal/sanitize"

Index

Functions

func QuoteBytes

func QuoteBytes(dst, buf []byte) []byte

func QuoteString

func QuoteString(dst []byte, str string) []byte

func SanitizeSQL

func SanitizeSQL(sql 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 Part

type Part any

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

type Query

type Query struct {
	Parts []Part
}

func NewQuery

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

func (*Query) Sanitize

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

Source Files

sanitize.go

Version
v5.7.3
Published
Mar 22, 2025
Platform
windows/amd64
Imports
9 packages
Last checked
4 hours ago

Tools for package owners.