parser

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const EOF = 0

Variables

This section is empty.

Functions

func Parse added in v0.3.2

func Parse(bind Bind, query string) (string, []string)

Parse transforms a named query into native query, respecting the bind param, returning the transformed query and a slice of identifiers.

func ParseIdents

func ParseIdents(bind Bind, query string) []string

ParseIdents is like Parse, but only return a slice of identifiers.

func ParseInClause added in v0.3.2

func ParseInClause(bind Bind, query string, args []any) (string, []any, error)

ParseInClause expands any binds in the query, respecting the bind param, that correspond to a slice in args to the length of that slice, and then appends those slice elements to a new arglist.

func ParseQuery

func ParseQuery(bind Bind, query string) string

ParseQuery is like Parse, but only return the query.

Types

type Bind added in v0.3.2

type Bind uint

Bind represent the placeholder used by different drivers.

const (
	BindUnknown  Bind = iota
	BindAt            // placeholder '@p1'
	BindColon         // placeholder ':name'
	BindDollar        // placeholder '$1'
	BindQuestion      // placeholder '?'
)

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser is an SQL query parser mostly for named queries.

Jump to

Keyboard shortcuts

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