dolphin

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dialect

func Dialect() core.Option

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

func NewCatalog

func NewCatalog() *catalog.Catalog

Types

type Parser

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

func NewFormatParser

func NewFormatParser() *Parser

NewFormatParser returns the parser sqlc fmt uses. It differs from the compiler's parser in one way: identifiers keep the case the author wrote. The compiler lowercases them so catalog lookups are case-insensitive, but a formatter that prints `Event` as `event` renames a table on the many servers where table names are case-sensitive.

func NewParser

func NewParser() *Parser

func (*Parser) Cast

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

Cast returns a type cast expression. MySQL uses CAST(expr AS type) syntax.

func (*Parser) Fingerprint

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

Fingerprint reduces a statement to a canonical form that survives changes in whitespace, keyword case, quoting style and redundant parentheses — and nothing else. Identifier case is preserved: MySQL table names are case-sensitive on most servers, so a formatting pass that changes one is a semantic change and must not fingerprint equal. fmt uses this as its proof that a formatted statement still means what the author wrote; a statement whose fingerprint it cannot match is left exactly as written.

func (*Parser) Param

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

Param returns the parameter placeholder for the given number. MySQL uses ? for all parameters (positional).

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 marino's lexer records as it scans.

func (*Parser) QuoteIdent

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

QuoteIdent returns a quoted identifier if it needs quoting. MySQL uses backticks for quoting identifiers.

func (*Parser) TypeName

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

TypeName returns the SQL type name for the given namespace and name. Handles MySQL-specific type name mappings for formatting.

Jump to

Keyboard shortcuts

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