sqlite

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: 18 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 SQLite's type system.

func NewCatalog

func NewCatalog() *catalog.Catalog

func NewIdentifier

func NewIdentifier(id *meyer.Ident) *ast.String

NewIdentifier returns the folded name of id as an ast.String, the shape sqlc uses for the parts of a ColumnRef or a function name.

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. SQLite uses CAST(expr AS type) syntax.

func (*Parser) CommentSyntax

func (p *Parser) CommentSyntax() source.CommentSyntax

func (*Parser) IsReservedKeyword

func (p *Parser) IsReservedKeyword(s string) bool

IsReservedKeyword reports whether s is a keyword in SQLite; see https://sqlite.org/lang_keywords.html. The table lives in meyer, which transcribes it from SQLite's own aKeywordTable.

func (*Parser) Param

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

Param returns the parameter placeholder for the given number. SQLite takes both a bare ? (the next index) and an explicit ?N, and they are not interchangeable — reordered ?N parameters bind by their numbers — so the one the author wrote is the one printed.

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, taken from the trivia meyer's single lexer pass produces alongside the tokens.

func (*Parser) QuoteIdent

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

QuoteIdent quotes an identifier when printing it bare would change what it names: the parser folds unquoted identifiers to lower case, so any name that is not already a plain lower-case identifier — or that collides with a keyword — only survives a parse round-trip inside double quotes.

func (*Parser) TypeName

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

TypeName returns the SQL type name for the given namespace and name.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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