Documentation
¶
Index ¶
- type Assert
- type Assignment
- type Block
- type Call
- type Case
- type CaseWhen
- type Close
- type Commit
- type Condition
- type Continue
- type CursorDeclaration
- type Declaration
- type DynamicExecute
- type ElseIf
- type Exception
- type Execute
- type Exit
- type Expr
- type Fetch
- type ForCursor
- type ForDynamic
- type ForEachArray
- type ForInt
- type ForQuery
- type ForSelect
- type GetDiagnostics
- type GetDiagnosticsItem
- type GetDiagnosticsItemList
- type GetDiagnosticsKind
- type If
- type Loop
- type Null
- type Open
- type Perform
- type Raise
- type RaiseOption
- type Return
- type ReturnNext
- type ReturnQuery
- type Rollback
- type Statement
- type StatementImpl
- type StatementVisitor
- type TaggedStatement
- type Variable
- type While
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assert ¶
type Assert struct {
StatementImpl
Condition Expr
Message Expr
}
stmt_assert
func (*Assert) PlpgSQLStatementTag ¶
type Assignment ¶
stmt_assign
func (*Assignment) CopyNode ¶
func (s *Assignment) CopyNode() *Assignment
func (*Assignment) Format ¶
func (s *Assignment) Format(ctx *tree.FmtCtx)
func (*Assignment) PlpgSQLStatementTag ¶
func (s *Assignment) PlpgSQLStatementTag() string
func (*Assignment) WalkStmt ¶
func (s *Assignment) WalkStmt(visitor StatementVisitor) (newStmt Statement, changed bool)
type Block ¶
type Block struct {
StatementImpl
Label string
Decls []Statement
Body []Statement
Exceptions []Exception
}
pl_block
func (*Block) PlpgSQLStatementTag ¶
type Call ¶
type Call struct {
StatementImpl
Expr Expr
IsCall bool
Target Variable
}
stmt_call
func (*Call) PlpgSQLStatementTag ¶
type Case ¶
type Case struct {
StatementImpl
// TODO(drewk): Change to Expr
TestExpr string
Var Variable
CaseWhenList []*CaseWhen
HaveElse bool
ElseStmts []Statement
}
stmt_case
func (*Case) Format ¶
TODO(drewk): fix the whitespace/newline formatting for CASE (see the stmt_case test file).
func (*Case) PlpgSQLStatementTag ¶
type CaseWhen ¶
type CaseWhen struct {
StatementImpl
// TODO(drewk): Change to Expr
Expr string
Stmts []Statement
}
func (*CaseWhen) PlpgSQLStatementTag ¶
type Close ¶
type Close struct {
StatementImpl
CurVar Variable
}
stmt_close
func (*Close) PlpgSQLStatementTag ¶
type Commit ¶
type Commit struct {
StatementImpl
Chain bool
}
stmt_commit
func (*Commit) PlpgSQLStatementTag ¶
type Continue ¶
type Continue struct {
StatementImpl
Label string
Condition Expr
}
stmt_continue
func (*Continue) PlpgSQLStatementTag ¶
type CursorDeclaration ¶
type CursorDeclaration struct {
StatementImpl
Name Variable
Scroll tree.CursorScrollOption
Query tree.Statement
}
func (*CursorDeclaration) CopyNode ¶
func (s *CursorDeclaration) CopyNode() *CursorDeclaration
func (*CursorDeclaration) Format ¶
func (s *CursorDeclaration) Format(ctx *tree.FmtCtx)
func (*CursorDeclaration) PlpgSQLStatementTag ¶
func (s *CursorDeclaration) PlpgSQLStatementTag() string
func (*CursorDeclaration) WalkStmt ¶
func (s *CursorDeclaration) WalkStmt(visitor StatementVisitor) (newStmt Statement, changed bool)
type Declaration ¶
type Declaration struct {
StatementImpl
Var Variable
Constant bool
Typ tree.ResolvableTypeReference
Collate string
NotNull bool
Expr Expr
}
decl_stmt
func (*Declaration) CopyNode ¶
func (s *Declaration) CopyNode() *Declaration
func (*Declaration) Format ¶
func (s *Declaration) Format(ctx *tree.FmtCtx)
func (*Declaration) PlpgSQLStatementTag ¶
func (s *Declaration) PlpgSQLStatementTag() string
func (*Declaration) WalkStmt ¶
func (s *Declaration) WalkStmt(visitor StatementVisitor) (newStmt Statement, changed bool)
type DynamicExecute ¶
type DynamicExecute struct {
StatementImpl
Query string
Into bool
Strict bool
Target Variable
Params []Expr
}
stmt_dynexecute TODO(chengxiong): query should be a better expression type.
func (*DynamicExecute) CopyNode ¶
func (s *DynamicExecute) CopyNode() *DynamicExecute
func (*DynamicExecute) Format ¶
func (s *DynamicExecute) Format(ctx *tree.FmtCtx)
func (*DynamicExecute) PlpgSQLStatementTag ¶
func (s *DynamicExecute) PlpgSQLStatementTag() string
func (*DynamicExecute) WalkStmt ¶
func (s *DynamicExecute) WalkStmt(visitor StatementVisitor) (newStmt Statement, changed bool)
type ElseIf ¶
type ElseIf struct {
StatementImpl
Condition Expr
Stmts []Statement
}
func (*ElseIf) PlpgSQLStatementTag ¶
type Exception ¶
type Exception struct {
StatementImpl
Conditions []Condition
Action []Statement
}
func (*Exception) PlpgSQLStatementTag ¶
type Execute ¶
type Execute struct {
StatementImpl
SqlStmt tree.Statement
Strict bool // INTO STRICT flag
Target []Variable
}
stmt_execsql
func (*Execute) PlpgSQLStatementTag ¶
type Exit ¶
type Exit struct {
StatementImpl
Label string
Condition Expr
}
stmt_exit
func (*Exit) PlpgSQLStatementTag ¶
type Fetch ¶
type Fetch struct {
StatementImpl
Cursor tree.CursorStmt
Target []Variable
IsMove bool
}
stmt_fetch stmt_move (where IsMove = true)
func (*Fetch) PlpgSQLStatementTag ¶
type ForCursor ¶
func (*ForCursor) PlpgSQLStatementTag ¶
type ForDynamic ¶
func (*ForDynamic) Format ¶
func (s *ForDynamic) Format(ctx *tree.FmtCtx)
func (*ForDynamic) PlpgSQLStatementTag ¶
func (s *ForDynamic) PlpgSQLStatementTag() string
func (*ForDynamic) WalkStmt ¶
func (s *ForDynamic) WalkStmt(visitor StatementVisitor) (newStmt Statement, changed bool)
type ForEachArray ¶
type ForEachArray struct {
StatementImpl
Label string
Var *Variable
Slice int // TODO(drewk): not sure what this is
Expr Expr
Body []Statement
}
stmt_foreach_a
func (*ForEachArray) Format ¶
func (s *ForEachArray) Format(ctx *tree.FmtCtx)
func (*ForEachArray) PlpgSQLStatementTag ¶
func (s *ForEachArray) PlpgSQLStatementTag() string
func (*ForEachArray) WalkStmt ¶
func (s *ForEachArray) WalkStmt(visitor StatementVisitor) (newStmt Statement, changed bool)
type ForInt ¶
type ForInt struct {
StatementImpl
Label string
Var Variable
Lower Expr
Upper Expr
Step Expr
Reverse int
Body []Statement
}
stmt_for
func (*ForInt) PlpgSQLStatementTag ¶
type ForQuery ¶
type ForQuery struct {
StatementImpl
Label string
Var Variable
Body []Statement
}
func (*ForQuery) PlpgSQLStatementTag ¶
type ForSelect ¶
func (*ForSelect) PlpgSQLStatementTag ¶
type GetDiagnostics ¶
type GetDiagnostics struct {
StatementImpl
IsStacked bool
DiagItems GetDiagnosticsItemList // TODO(drewk): what is this?
}
stmt_getdiag
func (*GetDiagnostics) Format ¶
func (s *GetDiagnostics) Format(ctx *tree.FmtCtx)
func (*GetDiagnostics) PlpgSQLStatementTag ¶
func (s *GetDiagnostics) PlpgSQLStatementTag() string
func (*GetDiagnostics) WalkStmt ¶
func (s *GetDiagnostics) WalkStmt(visitor StatementVisitor) (newStmt Statement, changed bool)
type GetDiagnosticsItem ¶
type GetDiagnosticsItem struct {
Kind GetDiagnosticsKind
// TODO(jane): TargetName is temporary -- should be removed and use Target.
TargetName string
Target int // where to assign it?
}
func (*GetDiagnosticsItem) Format ¶
func (s *GetDiagnosticsItem) Format(ctx *tree.FmtCtx)
type GetDiagnosticsItemList ¶
type GetDiagnosticsItemList []*GetDiagnosticsItem
type GetDiagnosticsKind ¶
type GetDiagnosticsKind int
GetDiagnosticsKind represents the type of error diagnostic item in stmt_getdiag.
const ( // GetDiagnosticsRowCount returns the number of rows processed by the recent // SQL command. GetDiagnosticsRowCount GetDiagnosticsKind = iota // GetDiagnosticsContext returns text describing the current call stack. GetDiagnosticsContext // GetDiagnosticsErrorContext returns text describing the exception's // callstack. GetDiagnosticsErrorContext // GetDiagnosticsErrorDetail returns the exceptions detail message. GetDiagnosticsErrorDetail // GetDiagnosticsErrorHint returns the exceptions hint message. GetDiagnosticsErrorHint // GetDiagnosticsReturnedSQLState returns the SQLSTATE error code related to // the exception. GetDiagnosticsReturnedSQLState // GetDiagnosticsColumnName returns the column name related to the exception. GetDiagnosticsColumnName // GetDiagnosticsConstraintName returns the constraint name related to // the exception. GetDiagnosticsConstraintName // GetDiagnosticsDatatypeName returns the data type name related to the // exception. GetDiagnosticsDatatypeName // GetDiagnosticsMessageText returns the exceptions primary message. GetDiagnosticsMessageText // GetDiagnosticsTableName returns the name of the table related to the // exception. GetDiagnosticsTableName // GetDiagnosticsSchemaName returns the name of the schema related to the // exception. GetDiagnosticsSchemaName )
func (GetDiagnosticsKind) String ¶
func (k GetDiagnosticsKind) String() string
String implements the fmt.Stringer interface.
type If ¶
type If struct {
StatementImpl
Condition Expr
ThenBody []Statement
ElseIfList []ElseIf
ElseBody []Statement
}
stmt_if
func (*If) PlpgSQLStatementTag ¶
type Loop ¶
type Loop struct {
StatementImpl
Label string
Body []Statement
}
stmt_loop
func (*Loop) PlpgSQLStatementTag ¶
type Open ¶
type Open struct {
StatementImpl
CurVar Variable
Scroll tree.CursorScrollOption
Query tree.Statement
}
stmt_open
func (*Open) PlpgSQLStatementTag ¶
type Perform ¶
type Perform struct {
StatementImpl
Expr Expr
}
stmt_perform
func (*Perform) PlpgSQLStatementTag ¶
type Raise ¶
type Raise struct {
StatementImpl
LogLevel string
Code string
CodeName string
Message string
Params []Expr
Options []RaiseOption
}
stmt_raise
func (*Raise) PlpgSQLStatementTag ¶
type RaiseOption ¶
func (*RaiseOption) Format ¶
func (s *RaiseOption) Format(ctx *tree.FmtCtx)
type Return ¶
type Return struct {
StatementImpl
Expr Expr
RetVar Variable
}
stmt_return
func (*Return) PlpgSQLStatementTag ¶
type ReturnNext ¶
type ReturnNext struct {
StatementImpl
Expr Expr
RetVar Variable
}
func (*ReturnNext) Format ¶
func (s *ReturnNext) Format(ctx *tree.FmtCtx)
func (*ReturnNext) PlpgSQLStatementTag ¶
func (s *ReturnNext) PlpgSQLStatementTag() string
func (*ReturnNext) WalkStmt ¶
func (s *ReturnNext) WalkStmt(visitor StatementVisitor) (newStmt Statement, changed bool)
type ReturnQuery ¶
type ReturnQuery struct {
StatementImpl
Query Expr
DynamicQuery Expr
Params []Expr
}
func (*ReturnQuery) Format ¶
func (s *ReturnQuery) Format(ctx *tree.FmtCtx)
func (*ReturnQuery) PlpgSQLStatementTag ¶
func (s *ReturnQuery) PlpgSQLStatementTag() string
func (*ReturnQuery) WalkStmt ¶
func (s *ReturnQuery) WalkStmt(visitor StatementVisitor) (newStmt Statement, changed bool)
type Rollback ¶
type Rollback struct {
StatementImpl
Chain bool
}
stmt_rollback
func (*Rollback) PlpgSQLStatementTag ¶
type Statement ¶
type Statement interface {
tree.NodeFormatter
GetLineNo() int
GetStmtID() uint
WalkStmt(StatementVisitor) (newStmt Statement, changed bool)
// contains filtered or unexported methods
}
func Walk ¶
func Walk(v StatementVisitor, stmt Statement) Statement
Walk traverses the plpgsql statement.
type StatementImpl ¶
type StatementImpl struct {
// TODO(Chengxiong): figure out how to get line number from scanner.
LineNo int
/*
* Unique statement ID in this function (starting at 1; 0 is invalid/not
* set). This can be used by a profiler as the index for an array of
* per-statement metrics.
*/
// TODO(Chengxiong): figure out how to get statement id from parser.
StmtID uint
}
func (*StatementImpl) GetLineNo ¶
func (s *StatementImpl) GetLineNo() int
func (*StatementImpl) GetStmtID ¶
func (s *StatementImpl) GetStmtID() uint
type StatementVisitor ¶
type StatementVisitor interface {
// Visit is called during a statement walk.
Visit(stmt Statement) (newStmt Statement, changed bool)
}
StatementVisitor defines methods that are called plpgsql statements during a statement walk.
type TaggedStatement ¶
type TaggedStatement interface {
PlpgSQLStatementTag() string
}
type While ¶
type While struct {
StatementImpl
Label string
Condition Expr
Body []Statement
}
stmt_while