compiler

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedStatementType = errors.New("parseQuery: unsupported statement type")

Functions

func ParseTableName added in v1.5.0

func ParseTableName(node ast.Node) (*ast.TableName, error)

func ParseTypeName added in v1.5.0

func ParseTypeName(node ast.Node) (*ast.TypeName, error)

Types

type Column added in v1.4.0

type Column struct {
	Name     string
	DataType string
	NotNull  bool
	IsArray  bool
	Comment  string
	Length   *int

	// XXX: Figure out what PostgreSQL calls `foo.id`
	Scope string
	Table *ast.TableName
	Type  *ast.TypeName
}

func ConvertColumn added in v1.5.0

func ConvertColumn(rel *ast.TableName, c *catalog.Column) *Column

type Compiler added in v1.5.0

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

func NewCompiler added in v1.5.0

func NewCompiler(conf config.SQL, combo config.CombinedSettings) *Compiler

func (*Compiler) Catalog added in v1.5.0

func (c *Compiler) Catalog() *catalog.Catalog

func (*Compiler) ParseCatalog added in v1.5.0

func (c *Compiler) ParseCatalog(schema []string) error

func (*Compiler) ParseQueries added in v1.5.0

func (c *Compiler) ParseQueries(queries []string, o opts.Parser) error

func (*Compiler) Result added in v1.5.0

func (c *Compiler) Result() *Result

type Function added in v1.8.0

type Function struct {
	Rel        *ast.FuncName
	ReturnType *ast.TypeName
}

type Parameter added in v1.4.0

type Parameter struct {
	Number int
	Column *Column
}

type Parser added in v1.4.0

type Parser interface {
	Parse(io.Reader) ([]ast.Statement, error)
	CommentSyntax() metadata.CommentSyntax
	IsReservedKeyword(string) bool
}

TODO: Rename this interface Engine

type Query added in v1.4.0

type Query struct {
	SQL      string
	Name     string
	Cmd      string // TODO: Pick a better name. One of: one, many, exec, execrows
	Columns  []*Column
	Params   []Parameter
	Comments []string

	// XXX: Hack
	Filename string
}

type QueryCatalog added in v1.4.0

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

func (QueryCatalog) GetFunc added in v1.8.0

func (qc QueryCatalog) GetFunc(rel *ast.FuncName) (*Function, error)

func (QueryCatalog) GetTable added in v1.4.0

func (qc QueryCatalog) GetTable(rel *ast.TableName) (*Table, error)

type Relation added in v1.5.0

type Relation struct {
	Catalog string
	Schema  string
	Name    string
}

func ParseRelationString added in v1.5.0

func ParseRelationString(name string) (*Relation, error)

type Result

type Result struct {
	Catalog *catalog.Catalog
	Queries []*Query
}

type Table added in v1.4.0

type Table struct {
	Rel     *ast.TableName
	Columns []*Column
}

Jump to

Keyboard shortcuts

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