Documentation
¶
Index ¶
- Variables
- func Dialect() core.Option
- func NewCatalog() *catalog.Catalog
- type Parser
- func (p *Parser) Cast(arg, typeName string) string
- func (p *Parser) CommentSyntax() source.CommentSyntax
- func (p *Parser) Fingerprint(sql string) (string, error)
- func (p *Parser) IsReservedKeyword(s string) bool
- func (p *Parser) Param(n int, numbered bool) string
- func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error)
- func (p *Parser) ParseFile(r io.Reader) (*ast.File, error)
- func (p *Parser) QuoteIdent(s string) string
- func (p *Parser) TypeName(ns, name string) string
Constants ¶
This section is empty.
Variables ¶
var Fingerprint = nodes.Fingerprint
var Parse = nodes.Parse
Functions ¶
func NewCatalog ¶
Types ¶
type Parser ¶
type Parser struct {
}
func (*Parser) CommentSyntax ¶
func (p *Parser) CommentSyntax() source.CommentSyntax
https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-COMMENTS
func (*Parser) Fingerprint ¶
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) IsReservedKeyword ¶
https://www.postgresql.org/docs/current/sql-keywords-appendix.html
func (*Parser) Param ¶
Param returns the parameter placeholder for the given number. PostgreSQL numbers every parameter: $1, $2, etc.
func (*Parser) ParseFile ¶
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 ¶
QuoteIdent returns a quoted identifier if it needs quoting. This implements the format.Dialect interface.