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

postgresql

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Fingerprint = nodes.Fingerprint
View Source
var Parse = nodes.Parse

Functions

func Dialect

func Dialect() core.Option

Dialect returns the catalog option that seeds PostgreSQL's type system.

func NewCatalog

func NewCatalog() *catalog.Catalog

Types

type Parser

type Parser struct {
}

func NewParser

func NewParser() *Parser

func (*Parser) Cast

func (p *Parser) Cast(arg, typeName string) string

Cast returns a type cast expression. PostgreSQL uses expr::type syntax.

func (*Parser) Fingerprint

func (p *Parser) Fingerprint(sql string) (string, error)

Fingerprint reduces a query to pg_query's fingerprint, which survives changes in whitespace, case and layout. sqlc fmt uses it to prove a formatted statement still parses to the same query.

func (*Parser) Param

func (p *Parser) Param(n int, numbered bool) string

Param returns the parameter placeholder for the given number. PostgreSQL numbers every parameter: $1, $2, etc.

func (*Parser) Parse

func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error)

func (*Parser) ParseFile

func (p *Parser) ParseFile(r io.Reader) (*ast.File, error)

ParseFile parses like Parse and also carries the file's comments, which oliphant's parser collects from the same pass its scanner already makes over the input.

func (*Parser) QuoteIdent

func (p *Parser) QuoteIdent(s string) string

QuoteIdent returns a quoted identifier if it needs quoting. This implements the format.Dialect interface.

func (*Parser) TypeName

func (p *Parser) TypeName(ns, name string) string

TypeName returns the SQL type name for the given namespace and name. This implements the format.Dialect interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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