ast

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChildrenNode

type ChildrenNode struct {
	Children []Node
}

func NewNode

func NewNode() *ChildrenNode

func (*ChildrenNode) AddChildren

func (n *ChildrenNode) AddChildren(ns ...Node) error

func (*ChildrenNode) GetStmt

func (n *ChildrenNode) GetStmt(ctx *Context) (string, error)

type ChooseNode

type ChooseNode struct {
	When      []*WhenNode
	Otherwise *OtherwiseNode
}

func NewChooseNode

func NewChooseNode() *ChooseNode

func (*ChooseNode) AddChildren

func (n *ChooseNode) AddChildren(ns ...Node) error

func (*ChooseNode) GetStmt

func (n *ChooseNode) GetStmt(ctx *Context) (string, error)

func (*ChooseNode) Scan

func (n *ChooseNode) Scan(start *xml.StartElement) error

type ConditionStmt added in v0.2.0

type ConditionStmt struct {
	*ChildrenNode
	// contains filtered or unexported fields
}

func NewConditionStmt added in v0.2.0

func NewConditionStmt() *ConditionStmt

func (*ConditionStmt) GetStmt added in v0.2.0

func (n *ConditionStmt) GetStmt(ctx *Context) (string, error)

func (*ConditionStmt) Scan added in v0.2.0

func (n *ConditionStmt) Scan(start *xml.StartElement) error

type Context

type Context struct {
	QueryType        string // select, insert, update, delete
	Variable         map[string]string
	Sqls             map[string]*SqlNode
	DefaultNamespace string // namespace of current mapper
}

func NewContext

func NewContext() *Context

func (*Context) GetSql

func (c *Context) GetSql(k string) (*SqlNode, bool)

func (*Context) GetVariable

func (c *Context) GetVariable(k string) (string, bool)

func (*Context) SetVariable

func (c *Context) SetVariable(k, v string)

type Data

type Data struct {
	Nodes []DataNode
	// contains filtered or unexported fields
}

func (*Data) AddChildren

func (d *Data) AddChildren(ns ...Node) error

func (*Data) GetStmt

func (d *Data) GetStmt(ctx *Context) (string, error)

func (*Data) Scan

func (d *Data) Scan(start *xml.StartElement) error

func (*Data) String

func (d *Data) String() string

type DataNode

type DataNode interface {
	String() string
}

type DynamicStmt added in v0.2.0

type DynamicStmt struct {
	*ChildrenNode
	// contains filtered or unexported fields
}

func NewDynamicStmt added in v0.2.0

func NewDynamicStmt() *DynamicStmt

func (*DynamicStmt) GetStmt added in v0.2.0

func (n *DynamicStmt) GetStmt(ctx *Context) (string, error)

func (*DynamicStmt) Scan added in v0.2.0

func (n *DynamicStmt) Scan(start *xml.StartElement) error

type ForeachNode

type ForeachNode struct {
	*ChildrenNode
	Open      string
	Close     string
	Separator string
}

func NewForeachNode

func NewForeachNode() *ForeachNode

func (*ForeachNode) GetStmt

func (n *ForeachNode) GetStmt(ctx *Context) (string, error)

func (*ForeachNode) Scan

func (n *ForeachNode) Scan(start *xml.StartElement) error

type IBatisData added in v0.2.0

type IBatisData struct {
	*Data
}

func NewIBatisData added in v0.2.0

func NewIBatisData(data []byte) *IBatisData

func (*IBatisData) ScanData added in v0.2.0

func (d *IBatisData) ScanData() error

type IfNode

type IfNode struct {
	*ChildrenNode
	Expression string
}

func NewIfNode

func NewIfNode() *IfNode

func (*IfNode) Scan

func (n *IfNode) Scan(start *xml.StartElement) error

type IncludeNode

type IncludeNode struct {
	RefId      DataNode
	Properties map[string]*PropertyNode
}

func NewIncludeNode

func NewIncludeNode() *IncludeNode

func (*IncludeNode) AddChildren

func (i *IncludeNode) AddChildren(ns ...Node) error

func (*IncludeNode) GetStmt

func (i *IncludeNode) GetStmt(ctx *Context) (string, error)

func (*IncludeNode) Scan

func (i *IncludeNode) Scan(start *xml.StartElement) error

type IterateStmt added in v0.2.0

type IterateStmt struct {
	*ForeachNode
	// contains filtered or unexported fields
}

func NewIterateStmt added in v0.2.0

func NewIterateStmt() *IterateStmt

func (*IterateStmt) GetStmt added in v0.2.0

func (n *IterateStmt) GetStmt(ctx *Context) (string, error)

func (*IterateStmt) Scan added in v0.2.0

func (n *IterateStmt) Scan(start *xml.StartElement) error

type Mapper

type Mapper struct {
	NameSpace      string
	SqlNodes       map[string]*SqlNode
	QueryNodeIndex map[string]*QueryNode
	QueryNodes     []*QueryNode
	FilePath       string
	// contains filtered or unexported fields
}

func NewMapper

func NewMapper() *Mapper

func (*Mapper) AddChildren

func (m *Mapper) AddChildren(ns ...Node) error

func (*Mapper) GetStmt

func (m *Mapper) GetStmt(ctx *Context) (string, error)

func (*Mapper) GetStmts

func (m *Mapper) GetStmts(ctx *Context, skipErrorQuery bool) ([]string, error)

func (*Mapper) Scan

func (m *Mapper) Scan(start *xml.StartElement) error

type Mappers added in v0.4.0

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

func NewMappers added in v0.4.0

func NewMappers() *Mappers

func (*Mappers) AddMapper added in v0.4.0

func (s *Mappers) AddMapper(ms ...*Mapper) error

func (*Mappers) GetStmts added in v0.4.0

func (s *Mappers) GetStmts(skipErrorQuery bool) ([]StmtInfo, error)

type MyBatisData added in v0.2.0

type MyBatisData struct {
	*Data
}

func NewMyBatisData added in v0.2.0

func NewMyBatisData(data []byte) *MyBatisData

func (*MyBatisData) ScanData added in v0.2.0

func (d *MyBatisData) ScanData() error

type Node

type Node interface {
	Scan(start *xml.StartElement) error
	AddChildren(ns ...Node) error
	GetStmt(ctx *Context) (string, error)
}

type OtherwiseNode

type OtherwiseNode struct {
	*ChildrenNode
}

func NewOtherwiseNode

func NewOtherwiseNode() *OtherwiseNode

func (*OtherwiseNode) Scan

func (n *OtherwiseNode) Scan(start *xml.StartElement) error

type Param

type Param struct {
	Name string
}

func (*Param) String

func (p *Param) String() string

type PropertyNode

type PropertyNode struct {
	Name  string
	Value string
}

func NewPropertyNode

func NewPropertyNode() *PropertyNode

func (*PropertyNode) AddChildren

func (p *PropertyNode) AddChildren(ns ...Node) error

func (*PropertyNode) GetStmt

func (p *PropertyNode) GetStmt(ctx *Context) (string, error)

func (*PropertyNode) Scan

func (p *PropertyNode) Scan(start *xml.StartElement) error

type QueryNode

type QueryNode struct {
	*ChildrenNode
	Id   string
	Type string
}

func NewQueryNode

func NewQueryNode() *QueryNode

func (*QueryNode) GetStmt

func (s *QueryNode) GetStmt(ctx *Context) (string, error)

func (*QueryNode) Scan

func (s *QueryNode) Scan(start *xml.StartElement) error

type SqlNode

type SqlNode struct {
	*ChildrenNode
	Id string
}

func NewSqlNode

func NewSqlNode() *SqlNode

func (*SqlNode) GetStmt

func (s *SqlNode) GetStmt(ctx *Context) (string, error)

func (*SqlNode) Scan

func (s *SqlNode) Scan(start *xml.StartElement) error

type StmtInfo added in v0.5.0

type StmtInfo struct {
	FilePath string
	SQL      string
}

type TrimNode

type TrimNode struct {
	*ChildrenNode
	Name            string
	Prefix          string
	Suffix          string
	PrefixOverrides []string
	SuffixOverrides []string
}

func NewTrimNode

func NewTrimNode() *TrimNode

func (*TrimNode) GetStmt

func (n *TrimNode) GetStmt(ctx *Context) (string, error)

func (*TrimNode) Scan

func (n *TrimNode) Scan(start *xml.StartElement) error

type Value

type Value string

func (Value) String

func (v Value) String() string

type Variable

type Variable struct {
	Name string
}

func (*Variable) String

func (p *Variable) String() string

type WhenNode

type WhenNode struct {
	*ChildrenNode
	Expression string
}

func NewWhenNode

func NewWhenNode() *WhenNode

func (*WhenNode) Scan

func (n *WhenNode) Scan(start *xml.StartElement) error

Jump to

Keyboard shortcuts

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