Documentation ¶
Index ¶
- Constants
- type Error
- type ErrorType
- type GoParam
- type GoVar
- type NameResolveVisitor
- func (b NameResolveVisitor) AppendErr(err Error)
- func (b NameResolveVisitor) DisableLogging(y bool)
- func (c *NameResolveVisitor) Enter(n ast.Node) (ast.Node, bool)
- func (b NameResolveVisitor) Errors() []error
- func (b NameResolveVisitor) FindInCtx(t ast.Node) (ast.Node, bool)
- func (b NameResolveVisitor) FindInCtxAnyOf(types ...ast.Node) (ast.Node, bool)
- func (b NameResolveVisitor) IsEnteringRoot() bool
- func (b NameResolveVisitor) IsLeavingRoot() bool
- func (c *NameResolveVisitor) Leave(n ast.Node) (ast.Node, bool)
- func (b NameResolveVisitor) LogCE(f string, args ...interface{})
- func (b NameResolveVisitor) LogInfo(f string, args ...interface{})
- func (b NameResolveVisitor) LogWarn(f string, args ...interface{})
- type OutputExtractVisitor
- func (b OutputExtractVisitor) AppendErr(err Error)
- func (b OutputExtractVisitor) DisableLogging(y bool)
- func (s *OutputExtractVisitor) Enter(n ast.Node) (ast.Node, bool)
- func (b OutputExtractVisitor) Errors() []error
- func (b OutputExtractVisitor) FindInCtx(t ast.Node) (ast.Node, bool)
- func (b OutputExtractVisitor) FindInCtxAnyOf(types ...ast.Node) (ast.Node, bool)
- func (b OutputExtractVisitor) IsEnteringRoot() bool
- func (b OutputExtractVisitor) IsLeavingRoot() bool
- func (s *OutputExtractVisitor) Leave(n ast.Node) (ast.Node, bool)
- func (b OutputExtractVisitor) LogCE(f string, args ...interface{})
- func (b OutputExtractVisitor) LogInfo(f string, args ...interface{})
- func (b OutputExtractVisitor) LogWarn(f string, args ...interface{})
- type ParamExtractVisitor
- func (b ParamExtractVisitor) AppendErr(err Error)
- func (b ParamExtractVisitor) DisableLogging(y bool)
- func (c *ParamExtractVisitor) Enter(n ast.Node) (ast.Node, bool)
- func (b ParamExtractVisitor) Errors() []error
- func (b ParamExtractVisitor) FindInCtx(t ast.Node) (ast.Node, bool)
- func (b ParamExtractVisitor) FindInCtxAnyOf(types ...ast.Node) (ast.Node, bool)
- func (b ParamExtractVisitor) IsEnteringRoot() bool
- func (b ParamExtractVisitor) IsLeavingRoot() bool
- func (c *ParamExtractVisitor) Leave(n ast.Node) (ast.Node, bool)
- func (b ParamExtractVisitor) LogCE(f string, args ...interface{})
- func (b ParamExtractVisitor) LogInfo(f string, args ...interface{})
- func (b ParamExtractVisitor) LogWarn(f string, args ...interface{})
- type PrintFunc
- type PrinterVisitor
- type StarElimVisitor
- func (b StarElimVisitor) AppendErr(err Error)
- func (b StarElimVisitor) DisableLogging(y bool)
- func (s *StarElimVisitor) Enter(n ast.Node) (ast.Node, bool)
- func (b StarElimVisitor) Errors() []error
- func (b StarElimVisitor) FindInCtx(t ast.Node) (ast.Node, bool)
- func (b StarElimVisitor) FindInCtxAnyOf(types ...ast.Node) (ast.Node, bool)
- func (b StarElimVisitor) IsEnteringRoot() bool
- func (b StarElimVisitor) IsLeavingRoot() bool
- func (s *StarElimVisitor) Leave(n ast.Node) (ast.Node, bool)
- func (b StarElimVisitor) LogCE(f string, args ...interface{})
- func (b StarElimVisitor) LogInfo(f string, args ...interface{})
- func (b StarElimVisitor) LogWarn(f string, args ...interface{})
- type TableAsVisitor
- func (b TableAsVisitor) AppendErr(err Error)
- func (b TableAsVisitor) DisableLogging(y bool)
- func (c *TableAsVisitor) Enter(n ast.Node) (ast.Node, bool)
- func (b TableAsVisitor) Errors() []error
- func (b TableAsVisitor) FindInCtx(t ast.Node) (ast.Node, bool)
- func (b TableAsVisitor) FindInCtxAnyOf(types ...ast.Node) (ast.Node, bool)
- func (b TableAsVisitor) IsEnteringRoot() bool
- func (b TableAsVisitor) IsLeavingRoot() bool
- func (c *TableAsVisitor) Leave(n ast.Node) (ast.Node, bool)
- func (b TableAsVisitor) LogCE(f string, args ...interface{})
- func (b TableAsVisitor) LogInfo(f string, args ...interface{})
- func (b TableAsVisitor) LogWarn(f string, args ...interface{})
- type TypeInferenceVisitor
- func (b TypeInferenceVisitor) AppendErr(err Error)
- func (b TypeInferenceVisitor) DisableLogging(y bool)
- func (t *TypeInferenceVisitor) Enter(n ast.Node) (ast.Node, bool)
- func (b TypeInferenceVisitor) Errors() []error
- func (b TypeInferenceVisitor) FindInCtx(t ast.Node) (ast.Node, bool)
- func (b TypeInferenceVisitor) FindInCtxAnyOf(types ...ast.Node) (ast.Node, bool)
- func (b TypeInferenceVisitor) IsEnteringRoot() bool
- func (b TypeInferenceVisitor) IsLeavingRoot() bool
- func (t *TypeInferenceVisitor) Leave(n ast.Node) (ast.Node, bool)
- func (b TypeInferenceVisitor) LogCE(f string, args ...interface{})
- func (b TypeInferenceVisitor) LogInfo(f string, args ...interface{})
- func (b TypeInferenceVisitor) LogWarn(f string, args ...interface{})
Constants ¶
const ( // LimitOffset is param name of the first ? of limit ?,? LimitOffset = "Offset" // LimitCount is param name of the second ? of limit ?,? LimitCount = "Count" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GoParam ¶
type GoParam struct { Name string TableName string InPattern bool Order int Marker *driver.ParamMarkerExpr }
GoParam is a param with name, order, and the pointer to param obj.
type NameResolveVisitor ¶
type NameResolveVisitor struct {
// contains filtered or unexported fields
}
NameResolveVisitor -
func NewNameResolveVisitor ¶
func NewNameResolveVisitor(db []schema.SQLTable) *NameResolveVisitor
NewNameResolveVisitor - after: all ColumnName will have fully qualified names (i.e. table.col), aliasing will be kept.
func (NameResolveVisitor) DisableLogging ¶ added in v0.3.0
func (b NameResolveVisitor) DisableLogging(y bool)
func (NameResolveVisitor) FindInCtxAnyOf ¶
FindInCtxAnyOf return closest node with type is any of @p types.
func (NameResolveVisitor) IsEnteringRoot ¶
func (b NameResolveVisitor) IsEnteringRoot() bool
IsEnteringRoot - enter in root node
func (NameResolveVisitor) IsLeavingRoot ¶
func (b NameResolveVisitor) IsLeavingRoot() bool
/ IsLeavingRoot - leave root node
func (NameResolveVisitor) LogCE ¶
func (b NameResolveVisitor) LogCE(f string, args ...interface{})
compiler error
type OutputExtractVisitor ¶
type OutputExtractVisitor struct { Output []GoVar // contains filtered or unexported fields }
OutputExtractVisitor -
func NewOutputExtractVisitor ¶
func NewOutputExtractVisitor() *OutputExtractVisitor
NewOutputExtractVisitor -
func (OutputExtractVisitor) DisableLogging ¶ added in v0.3.0
func (b OutputExtractVisitor) DisableLogging(y bool)
func (OutputExtractVisitor) FindInCtxAnyOf ¶
FindInCtxAnyOf return closest node with type is any of @p types.
func (OutputExtractVisitor) IsEnteringRoot ¶
func (b OutputExtractVisitor) IsEnteringRoot() bool
IsEnteringRoot - enter in root node
func (OutputExtractVisitor) IsLeavingRoot ¶
func (b OutputExtractVisitor) IsLeavingRoot() bool
/ IsLeavingRoot - leave root node
func (OutputExtractVisitor) LogCE ¶
func (b OutputExtractVisitor) LogCE(f string, args ...interface{})
compiler error
type ParamExtractVisitor ¶
type ParamExtractVisitor struct { Params []GoParam // contains filtered or unexported fields }
ParamExtractVisitor - only mysql driver are supported, backend pass. premis: insert stmt has only one value(?, ?...) markers.
func NewParamExtractVisitor ¶
func NewParamExtractVisitor() *ParamExtractVisitor
NewParamExtractVisitor -
func (ParamExtractVisitor) DisableLogging ¶ added in v0.3.0
func (b ParamExtractVisitor) DisableLogging(y bool)
func (ParamExtractVisitor) FindInCtxAnyOf ¶
FindInCtxAnyOf return closest node with type is any of @p types.
func (ParamExtractVisitor) IsEnteringRoot ¶
func (b ParamExtractVisitor) IsEnteringRoot() bool
IsEnteringRoot - enter in root node
func (ParamExtractVisitor) IsLeavingRoot ¶
func (b ParamExtractVisitor) IsLeavingRoot() bool
/ IsLeavingRoot - leave root node
func (ParamExtractVisitor) LogCE ¶
func (b ParamExtractVisitor) LogCE(f string, args ...interface{})
compiler error
type PrinterVisitor ¶
type PrinterVisitor struct {
// contains filtered or unexported fields
}
PrinterVisitor -
func NewPrinterVisitor ¶
func NewPrinterVisitor(print PrintFunc, format string) *PrinterVisitor
NewPrinterVisitor -
type StarElimVisitor ¶
type StarElimVisitor struct {
// contains filtered or unexported fields
}
StarElimVisitor - eliminate * in select by replacing it with a list of fields.
func NewStarElimVisitor ¶
func NewStarElimVisitor(tb schema.SQLTable) *StarElimVisitor
NewStarElimVisitor -
func (StarElimVisitor) DisableLogging ¶ added in v0.3.0
func (b StarElimVisitor) DisableLogging(y bool)
func (StarElimVisitor) FindInCtxAnyOf ¶
FindInCtxAnyOf return closest node with type is any of @p types.
func (StarElimVisitor) IsEnteringRoot ¶
func (b StarElimVisitor) IsEnteringRoot() bool
IsEnteringRoot - enter in root node
func (StarElimVisitor) IsLeavingRoot ¶
func (b StarElimVisitor) IsLeavingRoot() bool
/ IsLeavingRoot - leave root node
func (StarElimVisitor) LogCE ¶
func (b StarElimVisitor) LogCE(f string, args ...interface{})
compiler error
type TableAsVisitor ¶
type TableAsVisitor struct { TableNames map[string]bool TableAlias map[string]string // contains filtered or unexported fields }
TableAsVisitor - after apply, contains a mapping from alias to original table names. It will also check table name uniqueness, name shadowing.
func NewTableAsVisitor ¶
func NewTableAsVisitor(tableNames []string) *TableAsVisitor
NewTableAsVisitor - @p tableNames defined tables.
func (TableAsVisitor) DisableLogging ¶ added in v0.3.0
func (b TableAsVisitor) DisableLogging(y bool)
func (TableAsVisitor) FindInCtxAnyOf ¶
FindInCtxAnyOf return closest node with type is any of @p types.
func (TableAsVisitor) IsEnteringRoot ¶
func (b TableAsVisitor) IsEnteringRoot() bool
IsEnteringRoot - enter in root node
func (TableAsVisitor) IsLeavingRoot ¶
func (b TableAsVisitor) IsLeavingRoot() bool
/ IsLeavingRoot - leave root node
func (TableAsVisitor) LogCE ¶
func (b TableAsVisitor) LogCE(f string, args ...interface{})
compiler error
type TypeInferenceVisitor ¶
type TypeInferenceVisitor struct { DBInfo []schema.SQLTable // contains filtered or unexported fields }
TypeInferenceVisitor - assign types to terms. premise: all column names are fully qualified. after: all ColumnNameExpr will have its type field set to be the type defined
in the schema file. ColumnNameExpr in select will have its type field set to column's type, function call term's type will resolve to the type of the return value. Terms as input(driver.ParamMarkerExpr), will have its type, inferred from binary operations, assignments...
func NewTypeInferenceVisitor ¶
func NewTypeInferenceVisitor(dbs []schema.SQLTable) *TypeInferenceVisitor
NewTypeInferenceVisitor - schema is used for column's type.
func (TypeInferenceVisitor) DisableLogging ¶ added in v0.3.0
func (b TypeInferenceVisitor) DisableLogging(y bool)
func (TypeInferenceVisitor) FindInCtxAnyOf ¶
FindInCtxAnyOf return closest node with type is any of @p types.
func (TypeInferenceVisitor) IsEnteringRoot ¶
func (b TypeInferenceVisitor) IsEnteringRoot() bool
IsEnteringRoot - enter in root node
func (TypeInferenceVisitor) IsLeavingRoot ¶
func (b TypeInferenceVisitor) IsLeavingRoot() bool
/ IsLeavingRoot - leave root node
func (*TypeInferenceVisitor) Leave ¶
Leave - Implements Visitor premise: visitors visit left hand size of binary operation first.
func (TypeInferenceVisitor) LogCE ¶
func (b TypeInferenceVisitor) LogCE(f string, args ...interface{})
compiler error