compiler

package
v0.0.0-...-f5d25ad Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package compiler provides compiler implementations for compiling an (*ast.SQLStmt) into a (command.Command), which then can be executed by an (executor.Executor).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compiler

type Compiler interface {
	// Compile compiles an SQLStmt to a command, which can be used by an
	// executor. If an error occurs during the compiling, it will be returned.
	// If such an error is not fatal to the compile process and there occur more
	// errors, the returned error will contain all occurred errors until a fatal
	// error.
	Compile(*ast.SQLStmt) (command.Command, error)
}

Compiler describes a component that is able to convert an (*ast.SQLStmt) to a (command.Command).

func New

func New(opts ...Option) Compiler

New creates a new, ready to use compiler with the given options applied.

type Error

type Error string

Error is a helper type for creating constant errors.

const (
	// ErrUnsupported indicates that something is not supported. What exactly is
	// unsupported, must be indicated by a wrapping error.
	ErrUnsupported Error = "unsupported"
)

func (Error) Error

func (e Error) Error() string

type MultiError

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

MultiError is a wrapper for an error slice, which provides convenient wrapping of multiple errors into a single error. MultiError is not safe for concurrent use.

func (*MultiError) Append

func (e *MultiError) Append(err error)

Append appends an error to the multi error. If the error is nil, it will still be added.

func (*MultiError) Error

func (e *MultiError) Error() string

type Option

type Option func(*simpleCompiler)

Option is a functional option that can be applied to a compiler. If the option is applicable to the compiler, is determined by the compiler itself.

func OptionEnableOptimization

func OptionEnableOptimization(opt optimization.Optimization) Option

OptionEnableOptimization is used to enable the given optimization in a compiler.

Directories

Path Synopsis
Package command defines a command model, known as the intermediary representation.
Package command defines a command model, known as the intermediary representation.
Package optimization provides command optimizations that are used by the compiler.
Package optimization provides command optimizations that are used by the compiler.

Jump to

Keyboard shortcuts

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