sqlutils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AsRegexp = regexp.MustCompile(`(?i)\s+as\s+`)

AsRegexp matches case-insensitive " AS " with optional whitespace.

Functions

func AppendEscapedAliasedValue added in v0.1.0

func AppendEscapedAliasedValue(sb []byte, value string, quote byte) []byte

func AppendEscapedReference added in v0.1.0

func AppendEscapedReference(sb []byte, value string, quote byte) []byte

func AppendEscapedRelation added in v0.1.0

func AppendEscapedRelation(sb []byte, value string, quote byte) []byte

func ExpandNamedPlaceholders added in v0.1.0

func ExpandNamedPlaceholders(sql string, values map[string]any, nextPlaceholder func() string) (string, []interface{}, error)

ExpandNamedPlaceholders replaces named placeholders found outside SQL literals/comments while preserving appearance order and avoiding prefix collisions.

func ExpandPositionalPlaceholders added in v0.1.0

func ExpandPositionalPlaceholders(sql string, expectedCount int, nextPlaceholder func() string) (string, error)

ExpandPositionalPlaceholders replaces positional placeholders found outside SQL literals/comments using the supplied placeholder factory.

func InlinePlaceholders added in v0.1.0

func InlinePlaceholders(sql string, args []interface{}) (string, error)

InlinePlaceholders replaces placeholder tokens with their formatted literal values for debugging output.

func RelationSelectReference added in v0.1.0

func RelationSelectReference(value string) string

Types

type ParsedReference added in v0.1.0

type ParsedReference struct {
	Parts []string
	Alias string
}

func ParseAliasedValue added in v0.1.0

func ParseAliasedValue(value string) (ParsedReference, bool)

func ParseReference added in v0.1.0

func ParseReference(value string) (ParsedReference, bool)

func ParseRelationReference added in v0.1.0

func ParseRelationReference(value string) (ParsedReference, bool)

Jump to

Keyboard shortcuts

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