diff --git a/go/tools/astfmtgen/main.go b/go/tools/astfmtgen/main.go index 38a14d77e7a..01383171a01 100644 --- a/go/tools/astfmtgen/main.go +++ b/go/tools/astfmtgen/main.go @@ -120,10 +120,10 @@ func (r *Rewriter) Rewrite() error { func (r *Rewriter) replaceAstfmtCalls(cursor *astutil.Cursor) bool { switch v := cursor.Node().(type) { case *ast.Comment: - v.Text = strings.ReplaceAll(v.Text, " Format ", " formatFast ") + v.Text = strings.ReplaceAll(v.Text, " Format ", " FormatFast ") case *ast.FuncDecl: if v.Name.Name == "Format" { - v.Name.Name = "formatFast" + v.Name.Name = "FormatFast" } case *ast.ExprStmt: if call, ok := v.X.(*ast.CallExpr); ok { @@ -237,7 +237,7 @@ func (r *Rewriter) rewriteAstPrintf(cursor *astutil.Cursor, expr *ast.CallExpr) call = &ast.CallExpr{ Fun: &ast.SelectorExpr{ X: rightExpr, - Sel: &ast.Ident{Name: "formatFast"}, + Sel: &ast.Ident{Name: "FormatFast"}, }, Args: []ast.Expr{callexpr.X}, } diff --git a/go/vt/sqlparser/ast.go b/go/vt/sqlparser/ast.go index c167c9971c8..ea9bf37d244 100644 --- a/go/vt/sqlparser/ast.go +++ b/go/vt/sqlparser/ast.go @@ -31,7 +31,7 @@ related to these structs live in ast_funcs.go // generated by the parser. type SQLNode interface { Format(buf *TrackedBuffer) - formatFast(buf *TrackedBuffer) + FormatFast(buf *TrackedBuffer) } // Statements @@ -2232,7 +2232,7 @@ type ( type ( // Expr represents an expression. Expr interface { - iExpr() + IsExpr() SQLNode } @@ -3140,121 +3140,121 @@ type ( ) // iExpr ensures that only expressions nodes can be assigned to a Expr -func (*AndExpr) iExpr() {} -func (*OrExpr) iExpr() {} -func (*XorExpr) iExpr() {} -func (*NotExpr) iExpr() {} -func (*ComparisonExpr) iExpr() {} -func (*BetweenExpr) iExpr() {} -func (*IsExpr) iExpr() {} -func (*ExistsExpr) iExpr() {} -func (*AssignmentExpr) iExpr() {} -func (*Literal) iExpr() {} -func (*Argument) iExpr() {} -func (*NullVal) iExpr() {} -func (BoolVal) iExpr() {} -func (*ColName) iExpr() {} -func (ValTuple) iExpr() {} -func (*Subquery) iExpr() {} -func (ListArg) iExpr() {} -func (*BinaryExpr) iExpr() {} -func (*UnaryExpr) iExpr() {} -func (*IntroducerExpr) iExpr() {} -func (*CollateExpr) iExpr() {} -func (*FuncExpr) iExpr() {} -func (*TimestampDiffExpr) iExpr() {} -func (*ExtractFuncExpr) iExpr() {} -func (*WeightStringFuncExpr) iExpr() {} -func (*CurTimeFuncExpr) iExpr() {} -func (*CaseExpr) iExpr() {} -func (*ValuesFuncExpr) iExpr() {} -func (*CastExpr) iExpr() {} -func (*ConvertExpr) iExpr() {} -func (*SubstrExpr) iExpr() {} -func (*InsertExpr) iExpr() {} -func (*IntervalFuncExpr) iExpr() {} -func (*LocateExpr) iExpr() {} -func (*CharExpr) iExpr() {} -func (*ConvertUsingExpr) iExpr() {} -func (*MatchExpr) iExpr() {} -func (*Default) iExpr() {} -func (*TrimFuncExpr) iExpr() {} -func (*JSONSchemaValidFuncExpr) iExpr() {} -func (*JSONSchemaValidationReportFuncExpr) iExpr() {} -func (*Offset) iExpr() {} -func (*JSONPrettyExpr) iExpr() {} -func (*JSONStorageFreeExpr) iExpr() {} -func (*JSONStorageSizeExpr) iExpr() {} -func (*JSONContainsExpr) iExpr() {} -func (*JSONContainsPathExpr) iExpr() {} -func (*JSONExtractExpr) iExpr() {} -func (*JSONKeysExpr) iExpr() {} -func (*JSONOverlapsExpr) iExpr() {} -func (*JSONSearchExpr) iExpr() {} -func (*JSONValueExpr) iExpr() {} -func (*JSONArrayExpr) iExpr() {} -func (*JSONObjectExpr) iExpr() {} -func (*JSONQuoteExpr) iExpr() {} -func (*JSONAttributesExpr) iExpr() {} -func (*JSONValueModifierExpr) iExpr() {} -func (*JSONValueMergeExpr) iExpr() {} -func (*JSONRemoveExpr) iExpr() {} -func (*JSONUnquoteExpr) iExpr() {} -func (*MemberOfExpr) iExpr() {} -func (*RegexpInstrExpr) iExpr() {} -func (*RegexpLikeExpr) iExpr() {} -func (*RegexpReplaceExpr) iExpr() {} -func (*RegexpSubstrExpr) iExpr() {} -func (*IntervalDateExpr) iExpr() {} -func (*ArgumentLessWindowExpr) iExpr() {} -func (*FirstOrLastValueExpr) iExpr() {} -func (*NtileExpr) iExpr() {} -func (*NTHValueExpr) iExpr() {} -func (*LagLeadExpr) iExpr() {} -func (*NamedWindow) iExpr() {} -func (*ExtractValueExpr) iExpr() {} -func (*UpdateXMLExpr) iExpr() {} -func (*LockingFunc) iExpr() {} -func (*PerformanceSchemaFuncExpr) iExpr() {} -func (*GTIDFuncExpr) iExpr() {} -func (*Sum) iExpr() {} -func (*Min) iExpr() {} -func (*Max) iExpr() {} -func (*Avg) iExpr() {} -func (*CountStar) iExpr() {} -func (*Count) iExpr() {} -func (*GroupConcatExpr) iExpr() {} -func (*AnyValue) iExpr() {} -func (*BitAnd) iExpr() {} -func (*BitOr) iExpr() {} -func (*BitXor) iExpr() {} -func (*Std) iExpr() {} -func (*StdDev) iExpr() {} -func (*StdPop) iExpr() {} -func (*StdSamp) iExpr() {} -func (*VarPop) iExpr() {} -func (*VarSamp) iExpr() {} -func (*Variance) iExpr() {} -func (*Variable) iExpr() {} -func (*PointExpr) iExpr() {} -func (*LineStringExpr) iExpr() {} -func (*PolygonExpr) iExpr() {} -func (*MultiPolygonExpr) iExpr() {} -func (*MultiPointExpr) iExpr() {} -func (*MultiLinestringExpr) iExpr() {} -func (*GeomFromTextExpr) iExpr() {} -func (*GeomFromWKBExpr) iExpr() {} -func (*GeomFormatExpr) iExpr() {} -func (*GeomPropertyFuncExpr) iExpr() {} -func (*PointPropertyFuncExpr) iExpr() {} -func (*LinestrPropertyFuncExpr) iExpr() {} -func (*PolygonPropertyFuncExpr) iExpr() {} -func (*GeomCollPropertyFuncExpr) iExpr() {} -func (*GeoHashFromLatLongExpr) iExpr() {} -func (*GeoHashFromPointExpr) iExpr() {} -func (*GeomFromGeoHashExpr) iExpr() {} -func (*GeoJSONFromGeomExpr) iExpr() {} -func (*GeomFromGeoJSONExpr) iExpr() {} +func (*AndExpr) IsExpr() {} +func (*OrExpr) IsExpr() {} +func (*XorExpr) IsExpr() {} +func (*NotExpr) IsExpr() {} +func (*ComparisonExpr) IsExpr() {} +func (*BetweenExpr) IsExpr() {} +func (*IsExpr) IsExpr() {} +func (*ExistsExpr) IsExpr() {} +func (*AssignmentExpr) IsExpr() {} +func (*Literal) IsExpr() {} +func (*Argument) IsExpr() {} +func (*NullVal) IsExpr() {} +func (BoolVal) IsExpr() {} +func (*ColName) IsExpr() {} +func (ValTuple) IsExpr() {} +func (*Subquery) IsExpr() {} +func (ListArg) IsExpr() {} +func (*BinaryExpr) IsExpr() {} +func (*UnaryExpr) IsExpr() {} +func (*IntroducerExpr) IsExpr() {} +func (*CollateExpr) IsExpr() {} +func (*FuncExpr) IsExpr() {} +func (*TimestampDiffExpr) IsExpr() {} +func (*ExtractFuncExpr) IsExpr() {} +func (*WeightStringFuncExpr) IsExpr() {} +func (*CurTimeFuncExpr) IsExpr() {} +func (*CaseExpr) IsExpr() {} +func (*ValuesFuncExpr) IsExpr() {} +func (*CastExpr) IsExpr() {} +func (*ConvertExpr) IsExpr() {} +func (*SubstrExpr) IsExpr() {} +func (*InsertExpr) IsExpr() {} +func (*IntervalFuncExpr) IsExpr() {} +func (*LocateExpr) IsExpr() {} +func (*CharExpr) IsExpr() {} +func (*ConvertUsingExpr) IsExpr() {} +func (*MatchExpr) IsExpr() {} +func (*Default) IsExpr() {} +func (*TrimFuncExpr) IsExpr() {} +func (*JSONSchemaValidFuncExpr) IsExpr() {} +func (*JSONSchemaValidationReportFuncExpr) IsExpr() {} +func (*Offset) IsExpr() {} +func (*JSONPrettyExpr) IsExpr() {} +func (*JSONStorageFreeExpr) IsExpr() {} +func (*JSONStorageSizeExpr) IsExpr() {} +func (*JSONContainsExpr) IsExpr() {} +func (*JSONContainsPathExpr) IsExpr() {} +func (*JSONExtractExpr) IsExpr() {} +func (*JSONKeysExpr) IsExpr() {} +func (*JSONOverlapsExpr) IsExpr() {} +func (*JSONSearchExpr) IsExpr() {} +func (*JSONValueExpr) IsExpr() {} +func (*JSONArrayExpr) IsExpr() {} +func (*JSONObjectExpr) IsExpr() {} +func (*JSONQuoteExpr) IsExpr() {} +func (*JSONAttributesExpr) IsExpr() {} +func (*JSONValueModifierExpr) IsExpr() {} +func (*JSONValueMergeExpr) IsExpr() {} +func (*JSONRemoveExpr) IsExpr() {} +func (*JSONUnquoteExpr) IsExpr() {} +func (*MemberOfExpr) IsExpr() {} +func (*RegexpInstrExpr) IsExpr() {} +func (*RegexpLikeExpr) IsExpr() {} +func (*RegexpReplaceExpr) IsExpr() {} +func (*RegexpSubstrExpr) IsExpr() {} +func (*IntervalDateExpr) IsExpr() {} +func (*ArgumentLessWindowExpr) IsExpr() {} +func (*FirstOrLastValueExpr) IsExpr() {} +func (*NtileExpr) IsExpr() {} +func (*NTHValueExpr) IsExpr() {} +func (*LagLeadExpr) IsExpr() {} +func (*NamedWindow) IsExpr() {} +func (*ExtractValueExpr) IsExpr() {} +func (*UpdateXMLExpr) IsExpr() {} +func (*LockingFunc) IsExpr() {} +func (*PerformanceSchemaFuncExpr) IsExpr() {} +func (*GTIDFuncExpr) IsExpr() {} +func (*Sum) IsExpr() {} +func (*Min) IsExpr() {} +func (*Max) IsExpr() {} +func (*Avg) IsExpr() {} +func (*CountStar) IsExpr() {} +func (*Count) IsExpr() {} +func (*GroupConcatExpr) IsExpr() {} +func (*AnyValue) IsExpr() {} +func (*BitAnd) IsExpr() {} +func (*BitOr) IsExpr() {} +func (*BitXor) IsExpr() {} +func (*Std) IsExpr() {} +func (*StdDev) IsExpr() {} +func (*StdPop) IsExpr() {} +func (*StdSamp) IsExpr() {} +func (*VarPop) IsExpr() {} +func (*VarSamp) IsExpr() {} +func (*Variance) IsExpr() {} +func (*Variable) IsExpr() {} +func (*PointExpr) IsExpr() {} +func (*LineStringExpr) IsExpr() {} +func (*PolygonExpr) IsExpr() {} +func (*MultiPolygonExpr) IsExpr() {} +func (*MultiPointExpr) IsExpr() {} +func (*MultiLinestringExpr) IsExpr() {} +func (*GeomFromTextExpr) IsExpr() {} +func (*GeomFromWKBExpr) IsExpr() {} +func (*GeomFormatExpr) IsExpr() {} +func (*GeomPropertyFuncExpr) IsExpr() {} +func (*PointPropertyFuncExpr) IsExpr() {} +func (*LinestrPropertyFuncExpr) IsExpr() {} +func (*PolygonPropertyFuncExpr) IsExpr() {} +func (*GeomCollPropertyFuncExpr) IsExpr() {} +func (*GeoHashFromLatLongExpr) IsExpr() {} +func (*GeoHashFromPointExpr) IsExpr() {} +func (*GeomFromGeoHashExpr) IsExpr() {} +func (*GeoJSONFromGeomExpr) IsExpr() {} +func (*GeomFromGeoJSONExpr) IsExpr() {} // iCallable marks all expressions that represent function calls func (*FuncExpr) iCallable() {} diff --git a/go/vt/sqlparser/ast_format_fast.go b/go/vt/sqlparser/ast_format_fast.go index 70baca7a46b..16d52cac9d2 100644 --- a/go/vt/sqlparser/ast_format_fast.go +++ b/go/vt/sqlparser/ast_format_fast.go @@ -23,13 +23,13 @@ import ( "vitess.io/vitess/go/sqltypes" ) -// formatFast formats the node. -func (node *Select) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Select) FormatFast(buf *TrackedBuffer) { if node.With != nil { - node.With.formatFast(buf) + node.With.FormatFast(buf) } buf.WriteString("select ") - node.Comments.formatFast(buf) + node.Comments.FormatFast(buf) if node.Distinct { buf.WriteString(DistinctStr) @@ -48,50 +48,50 @@ func (node *Select) formatFast(buf *TrackedBuffer) { buf.WriteString(SQLCalcFoundRowsStr) } - node.SelectExprs.formatFast(buf) + node.SelectExprs.FormatFast(buf) buf.WriteString(" from ") prefix := "" for _, expr := range node.From { buf.WriteString(prefix) - expr.formatFast(buf) + expr.FormatFast(buf) prefix = ", " } - node.Where.formatFast(buf) + node.Where.FormatFast(buf) - node.GroupBy.formatFast(buf) + node.GroupBy.FormatFast(buf) - node.Having.formatFast(buf) + node.Having.FormatFast(buf) if node.Windows != nil { buf.WriteByte(' ') - node.Windows.formatFast(buf) + node.Windows.FormatFast(buf) } - node.OrderBy.formatFast(buf) + node.OrderBy.FormatFast(buf) - node.Limit.formatFast(buf) + node.Limit.FormatFast(buf) buf.WriteString(node.Lock.ToString()) - node.Into.formatFast(buf) + node.Into.FormatFast(buf) } -// formatFast formats the node. -func (node *CommentOnly) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *CommentOnly) FormatFast(buf *TrackedBuffer) { for _, comment := range node.Comments { buf.WriteString(comment) } } -// formatFast formats the node. -func (node *Union) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Union) FormatFast(buf *TrackedBuffer) { if requiresParen(node.Left) { buf.WriteByte('(') - node.Left.formatFast(buf) + node.Left.FormatFast(buf) buf.WriteByte(')') } else { - node.Left.formatFast(buf) + node.Left.FormatFast(buf) } buf.WriteByte(' ') @@ -104,103 +104,103 @@ func (node *Union) formatFast(buf *TrackedBuffer) { if requiresParen(node.Right) { buf.WriteByte('(') - node.Right.formatFast(buf) + node.Right.FormatFast(buf) buf.WriteByte(')') } else { - node.Right.formatFast(buf) + node.Right.FormatFast(buf) } - node.OrderBy.formatFast(buf) - node.Limit.formatFast(buf) + node.OrderBy.FormatFast(buf) + node.Limit.FormatFast(buf) buf.WriteString(node.Lock.ToString()) } -// formatFast formats the node. -func (node *VStream) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *VStream) FormatFast(buf *TrackedBuffer) { buf.WriteString("vstream ") - node.Comments.formatFast(buf) - node.SelectExpr.formatFast(buf) + node.Comments.FormatFast(buf) + node.SelectExpr.FormatFast(buf) buf.WriteString(" from ") - node.Table.formatFast(buf) + node.Table.FormatFast(buf) } -// formatFast formats the node. -func (node *Stream) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Stream) FormatFast(buf *TrackedBuffer) { buf.WriteString("stream ") - node.Comments.formatFast(buf) - node.SelectExpr.formatFast(buf) + node.Comments.FormatFast(buf) + node.SelectExpr.FormatFast(buf) buf.WriteString(" from ") - node.Table.formatFast(buf) + node.Table.FormatFast(buf) } -// formatFast formats the node. -func (node *Insert) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Insert) FormatFast(buf *TrackedBuffer) { switch node.Action { case InsertAct: buf.WriteString(InsertStr) buf.WriteByte(' ') - node.Comments.formatFast(buf) + node.Comments.FormatFast(buf) buf.WriteString(node.Ignore.ToString()) buf.WriteString("into ") - node.Table.Expr.formatFast(buf) + node.Table.Expr.FormatFast(buf) - node.Partitions.formatFast(buf) + node.Partitions.FormatFast(buf) - node.Columns.formatFast(buf) + node.Columns.FormatFast(buf) buf.WriteByte(' ') - node.Rows.formatFast(buf) + node.Rows.FormatFast(buf) - node.OnDup.formatFast(buf) + node.OnDup.FormatFast(buf) case ReplaceAct: buf.WriteString(ReplaceStr) buf.WriteByte(' ') - node.Comments.formatFast(buf) + node.Comments.FormatFast(buf) buf.WriteString(node.Ignore.ToString()) buf.WriteString("into ") - node.Table.Expr.formatFast(buf) + node.Table.Expr.FormatFast(buf) - node.Partitions.formatFast(buf) + node.Partitions.FormatFast(buf) - node.Columns.formatFast(buf) + node.Columns.FormatFast(buf) buf.WriteByte(' ') - node.Rows.formatFast(buf) + node.Rows.FormatFast(buf) - node.OnDup.formatFast(buf) + node.OnDup.FormatFast(buf) default: buf.WriteString("Unkown Insert Action") buf.WriteByte(' ') - node.Comments.formatFast(buf) + node.Comments.FormatFast(buf) buf.WriteString(node.Ignore.ToString()) buf.WriteString("into ") - node.Table.Expr.formatFast(buf) + node.Table.Expr.FormatFast(buf) - node.Partitions.formatFast(buf) + node.Partitions.FormatFast(buf) - node.Columns.formatFast(buf) + node.Columns.FormatFast(buf) buf.WriteByte(' ') - node.Rows.formatFast(buf) + node.Rows.FormatFast(buf) - node.OnDup.formatFast(buf) + node.OnDup.FormatFast(buf) } } -// formatFast formats the node. -func (node *With) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *With) FormatFast(buf *TrackedBuffer) { buf.WriteString("with ") if node.Recursive { @@ -208,87 +208,87 @@ func (node *With) formatFast(buf *TrackedBuffer) { } ctesLength := len(node.ctes) for i := 0; i < ctesLength-1; i++ { - node.ctes[i].formatFast(buf) + node.ctes[i].FormatFast(buf) buf.WriteString(", ") } - node.ctes[ctesLength-1].formatFast(buf) + node.ctes[ctesLength-1].FormatFast(buf) } -// formatFast formats the node. -func (node *CommonTableExpr) formatFast(buf *TrackedBuffer) { - node.ID.formatFast(buf) - node.Columns.formatFast(buf) +// FormatFast formats the node. +func (node *CommonTableExpr) FormatFast(buf *TrackedBuffer) { + node.ID.FormatFast(buf) + node.Columns.FormatFast(buf) buf.WriteString(" as ") - node.Subquery.formatFast(buf) + node.Subquery.FormatFast(buf) buf.WriteByte(' ') } -// formatFast formats the node. -func (node *Update) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Update) FormatFast(buf *TrackedBuffer) { if node.With != nil { - node.With.formatFast(buf) + node.With.FormatFast(buf) } buf.WriteString("update ") - node.Comments.formatFast(buf) + node.Comments.FormatFast(buf) buf.WriteString(node.Ignore.ToString()) - node.TableExprs.formatFast(buf) + node.TableExprs.FormatFast(buf) buf.WriteString(" set ") - node.Exprs.formatFast(buf) + node.Exprs.FormatFast(buf) - node.Where.formatFast(buf) + node.Where.FormatFast(buf) - node.OrderBy.formatFast(buf) + node.OrderBy.FormatFast(buf) - node.Limit.formatFast(buf) + node.Limit.FormatFast(buf) } -// formatFast formats the node. -func (node *Delete) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Delete) FormatFast(buf *TrackedBuffer) { if node.With != nil { - node.With.formatFast(buf) + node.With.FormatFast(buf) } buf.WriteString("delete ") - node.Comments.formatFast(buf) + node.Comments.FormatFast(buf) if node.Ignore { buf.WriteString("ignore ") } if node.Targets != nil { - node.Targets.formatFast(buf) + node.Targets.FormatFast(buf) buf.WriteByte(' ') } buf.WriteString("from ") - node.TableExprs.formatFast(buf) - node.Partitions.formatFast(buf) - node.Where.formatFast(buf) - node.OrderBy.formatFast(buf) - node.Limit.formatFast(buf) + node.TableExprs.FormatFast(buf) + node.Partitions.FormatFast(buf) + node.Where.FormatFast(buf) + node.OrderBy.FormatFast(buf) + node.Limit.FormatFast(buf) } -// formatFast formats the node. -func (node *Set) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Set) FormatFast(buf *TrackedBuffer) { buf.WriteString("set ") - node.Comments.formatFast(buf) - node.Exprs.formatFast(buf) + node.Comments.FormatFast(buf) + node.Exprs.FormatFast(buf) } -// formatFast formats the node. -func (node *DropDatabase) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *DropDatabase) FormatFast(buf *TrackedBuffer) { exists := "" if node.IfExists { exists = "if exists " } buf.WriteString(DropStr) buf.WriteByte(' ') - node.Comments.formatFast(buf) + node.Comments.FormatFast(buf) buf.WriteString("database ") buf.WriteString(exists) - node.DBName.formatFast(buf) + node.DBName.FormatFast(buf) } -// formatFast formats the node. -func (node *Flush) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Flush) FormatFast(buf *TrackedBuffer) { buf.WriteString(FlushStr) if node.IsLocal { buf.WriteString(" local") @@ -304,7 +304,7 @@ func (node *Flush) formatFast(buf *TrackedBuffer) { buf.WriteString(" tables") if len(node.TableNames) != 0 { buf.WriteByte(' ') - node.TableNames.formatFast(buf) + node.TableNames.FormatFast(buf) } if node.ForExport { buf.WriteString(" for export") @@ -315,72 +315,72 @@ func (node *Flush) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (node *AlterVschema) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *AlterVschema) FormatFast(buf *TrackedBuffer) { switch node.Action { case CreateVindexDDLAction: buf.WriteString("alter vschema create vindex ") - node.Table.formatFast(buf) + node.Table.FormatFast(buf) buf.WriteByte(' ') - node.VindexSpec.formatFast(buf) + node.VindexSpec.FormatFast(buf) case DropVindexDDLAction: buf.WriteString("alter vschema drop vindex ") - node.Table.formatFast(buf) + node.Table.FormatFast(buf) case AddVschemaTableDDLAction: buf.WriteString("alter vschema add table ") - node.Table.formatFast(buf) + node.Table.FormatFast(buf) case DropVschemaTableDDLAction: buf.WriteString("alter vschema drop table ") - node.Table.formatFast(buf) + node.Table.FormatFast(buf) case AddColVindexDDLAction: buf.WriteString("alter vschema on ") - node.Table.formatFast(buf) + node.Table.FormatFast(buf) buf.WriteString(" add vindex ") - node.VindexSpec.Name.formatFast(buf) + node.VindexSpec.Name.FormatFast(buf) buf.WriteString(" (") for i, col := range node.VindexCols { if i != 0 { buf.WriteString(", ") - col.formatFast(buf) + col.FormatFast(buf) } else { - col.formatFast(buf) + col.FormatFast(buf) } } buf.WriteByte(')') if node.VindexSpec.Type.String() != "" { buf.WriteByte(' ') - node.VindexSpec.formatFast(buf) + node.VindexSpec.FormatFast(buf) } case DropColVindexDDLAction: buf.WriteString("alter vschema on ") - node.Table.formatFast(buf) + node.Table.FormatFast(buf) buf.WriteString(" drop vindex ") - node.VindexSpec.Name.formatFast(buf) + node.VindexSpec.Name.FormatFast(buf) case AddSequenceDDLAction: buf.WriteString("alter vschema add sequence ") - node.Table.formatFast(buf) + node.Table.FormatFast(buf) case DropSequenceDDLAction: buf.WriteString("alter vschema drop sequence ") - node.Table.formatFast(buf) + node.Table.FormatFast(buf) case AddAutoIncDDLAction: buf.WriteString("alter vschema on ") - node.Table.formatFast(buf) + node.Table.FormatFast(buf) buf.WriteString(" add auto_increment ") - node.AutoIncSpec.formatFast(buf) + node.AutoIncSpec.FormatFast(buf) case DropAutoIncDDLAction: buf.WriteString("alter vschema on ") - node.Table.formatFast(buf) + node.Table.FormatFast(buf) buf.WriteString(" drop auto_increment ") - node.AutoIncSpec.formatFast(buf) + node.AutoIncSpec.FormatFast(buf) default: buf.WriteString(node.Action.ToString()) buf.WriteString(" table ") - node.Table.formatFast(buf) + node.Table.FormatFast(buf) } } -// formatFast formats the node. -func (node *AlterMigration) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *AlterMigration) FormatFast(buf *TrackedBuffer) { buf.WriteString("alter vitess_migration") if node.UUID != "" { buf.WriteString(" '") @@ -423,7 +423,7 @@ func (node *AlterMigration) formatFast(buf *TrackedBuffer) { } if node.Ratio != nil { buf.WriteString(" ratio ") - node.Ratio.formatFast(buf) + node.Ratio.FormatFast(buf) } if node.Shards != "" { buf.WriteString(" vitess_shards '") @@ -432,40 +432,40 @@ func (node *AlterMigration) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (node *RevertMigration) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *RevertMigration) FormatFast(buf *TrackedBuffer) { buf.WriteString("revert ") - node.Comments.formatFast(buf) + node.Comments.FormatFast(buf) buf.WriteString("vitess_migration '") buf.WriteString(node.UUID) buf.WriteByte('\'') } -// formatFast formats the node. -func (node *ShowMigrationLogs) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *ShowMigrationLogs) FormatFast(buf *TrackedBuffer) { buf.WriteString("show vitess_migration '") buf.WriteString(node.UUID) buf.WriteString("' logs") } -// formatFast formats the node. -func (node *ShowThrottledApps) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *ShowThrottledApps) FormatFast(buf *TrackedBuffer) { buf.WriteString("show vitess_throttled_apps") } -// formatFast formats the node. -func (node *ShowThrottlerStatus) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *ShowThrottlerStatus) FormatFast(buf *TrackedBuffer) { buf.WriteString("show vitess_throttler status") } -// formatFast formats the node. -func (node *OptLike) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *OptLike) FormatFast(buf *TrackedBuffer) { buf.WriteString("like ") - node.LikeTable.formatFast(buf) + node.LikeTable.FormatFast(buf) } -// formatFast formats the node. -func (node *PartitionSpec) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *PartitionSpec) FormatFast(buf *TrackedBuffer) { switch node.Action { case ReorganizeAction: buf.WriteString(ReorganizeStr) @@ -474,20 +474,20 @@ func (node *PartitionSpec) formatFast(buf *TrackedBuffer) { if i != 0 { buf.WriteString(", ") } - n.formatFast(buf) + n.FormatFast(buf) } buf.WriteString(" into (") for i, pd := range node.Definitions { if i != 0 { buf.WriteString(", ") } - pd.formatFast(buf) + pd.FormatFast(buf) } buf.WriteByte(')') case AddAction: buf.WriteString(AddStr) buf.WriteString(" (") - node.Definitions[0].formatFast(buf) + node.Definitions[0].FormatFast(buf) buf.WriteByte(')') case DropAction: buf.WriteString(DropPartitionStr) @@ -496,7 +496,7 @@ func (node *PartitionSpec) formatFast(buf *TrackedBuffer) { if i != 0 { buf.WriteString(", ") } - n.formatFast(buf) + n.FormatFast(buf) } case DiscardAction: buf.WriteString(DiscardStr) @@ -507,7 +507,7 @@ func (node *PartitionSpec) formatFast(buf *TrackedBuffer) { prefix := "" for _, n := range node.Names { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } @@ -521,7 +521,7 @@ func (node *PartitionSpec) formatFast(buf *TrackedBuffer) { prefix := "" for _, n := range node.Names { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } @@ -535,20 +535,20 @@ func (node *PartitionSpec) formatFast(buf *TrackedBuffer) { prefix := "" for _, n := range node.Names { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } case CoalesceAction: buf.WriteString(CoalesceStr) buf.WriteByte(' ') - node.Number.formatFast(buf) + node.Number.FormatFast(buf) case ExchangeAction: buf.WriteString(ExchangeStr) buf.WriteByte(' ') - node.Names[0].formatFast(buf) + node.Names[0].FormatFast(buf) buf.WriteString(" with table ") - node.TableName.formatFast(buf) + node.TableName.FormatFast(buf) if node.WithoutValidation { buf.WriteString(" without validation") } @@ -561,7 +561,7 @@ func (node *PartitionSpec) formatFast(buf *TrackedBuffer) { prefix := "" for _, n := range node.Names { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } @@ -574,7 +574,7 @@ func (node *PartitionSpec) formatFast(buf *TrackedBuffer) { prefix := "" for _, n := range node.Names { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } @@ -587,7 +587,7 @@ func (node *PartitionSpec) formatFast(buf *TrackedBuffer) { prefix := "" for _, n := range node.Names { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } @@ -600,7 +600,7 @@ func (node *PartitionSpec) formatFast(buf *TrackedBuffer) { prefix := "" for _, n := range node.Names { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } @@ -613,7 +613,7 @@ func (node *PartitionSpec) formatFast(buf *TrackedBuffer) { prefix := "" for _, n := range node.Names { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } @@ -626,34 +626,34 @@ func (node *PartitionSpec) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node -func (node *PartitionDefinition) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *PartitionDefinition) FormatFast(buf *TrackedBuffer) { buf.WriteString("partition ") - node.Name.formatFast(buf) - node.Options.formatFast(buf) + node.Name.FormatFast(buf) + node.Options.FormatFast(buf) } -// formatFast formats the node -func (node *PartitionDefinitionOptions) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *PartitionDefinitionOptions) FormatFast(buf *TrackedBuffer) { if node.ValueRange != nil { buf.WriteByte(' ') - node.ValueRange.formatFast(buf) + node.ValueRange.FormatFast(buf) } if node.Engine != nil { buf.WriteByte(' ') - node.Engine.formatFast(buf) + node.Engine.FormatFast(buf) } if node.Comment != nil { buf.WriteString(" comment ") - node.Comment.formatFast(buf) + node.Comment.FormatFast(buf) } if node.DataDirectory != nil { buf.WriteString(" data directory ") - node.DataDirectory.formatFast(buf) + node.DataDirectory.FormatFast(buf) } if node.IndexDirectory != nil { buf.WriteString(" index directory ") - node.IndexDirectory.formatFast(buf) + node.IndexDirectory.FormatFast(buf) } if node.MaxRows != nil { buf.WriteString(" max_rows ") @@ -669,45 +669,45 @@ func (node *PartitionDefinitionOptions) formatFast(buf *TrackedBuffer) { } if node.SubPartitionDefinitions != nil { buf.WriteString(" (") - node.SubPartitionDefinitions.formatFast(buf) + node.SubPartitionDefinitions.FormatFast(buf) buf.WriteByte(')') } } -// formatFast formats the node -func (node SubPartitionDefinitions) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node SubPartitionDefinitions) FormatFast(buf *TrackedBuffer) { var prefix string for _, n := range node { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } -// formatFast formats the node -func (node *SubPartitionDefinition) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *SubPartitionDefinition) FormatFast(buf *TrackedBuffer) { buf.WriteString("subpartition ") - node.Name.formatFast(buf) - node.Options.formatFast(buf) + node.Name.FormatFast(buf) + node.Options.FormatFast(buf) } -// formatFast formats the node -func (node *SubPartitionDefinitionOptions) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *SubPartitionDefinitionOptions) FormatFast(buf *TrackedBuffer) { if node.Engine != nil { buf.WriteByte(' ') - node.Engine.formatFast(buf) + node.Engine.FormatFast(buf) } if node.Comment != nil { buf.WriteString(" comment ") - node.Comment.formatFast(buf) + node.Comment.FormatFast(buf) } if node.DataDirectory != nil { buf.WriteString(" data directory ") - node.DataDirectory.formatFast(buf) + node.DataDirectory.FormatFast(buf) } if node.IndexDirectory != nil { buf.WriteString(" index directory ") - node.IndexDirectory.formatFast(buf) + node.IndexDirectory.FormatFast(buf) } if node.MaxRows != nil { buf.WriteString(" max_rows ") @@ -723,20 +723,20 @@ func (node *SubPartitionDefinitionOptions) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node -func (node *PartitionValueRange) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *PartitionValueRange) FormatFast(buf *TrackedBuffer) { buf.WriteString("values ") buf.WriteString(node.Type.ToString()) if node.Maxvalue { buf.WriteString(" maxvalue") } else { buf.WriteByte(' ') - node.Range.formatFast(buf) + node.Range.FormatFast(buf) } } -// formatFast formats the node -func (node *PartitionEngine) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *PartitionEngine) FormatFast(buf *TrackedBuffer) { if node.Storage { buf.WriteString("storage ") } @@ -744,8 +744,8 @@ func (node *PartitionEngine) formatFast(buf *TrackedBuffer) { buf.WriteString(node.Name) } -// formatFast formats the node. -func (node *PartitionOption) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *PartitionOption) FormatFast(buf *TrackedBuffer) { buf.WriteString("\npartition by") if node.IsLinear { buf.WriteString(" linear") @@ -754,7 +754,7 @@ func (node *PartitionOption) formatFast(buf *TrackedBuffer) { switch node.Type { case HashType: buf.WriteString(" hash (") - node.Expr.formatFast(buf) + node.Expr.FormatFast(buf) buf.WriteByte(')') case KeyType: buf.WriteString(" key") @@ -766,18 +766,18 @@ func (node *PartitionOption) formatFast(buf *TrackedBuffer) { buf.WriteString(" ()") } else { buf.WriteByte(' ') - node.ColList.formatFast(buf) + node.ColList.FormatFast(buf) } case RangeType, ListType: buf.WriteByte(' ') buf.WriteString(node.Type.ToString()) if node.Expr != nil { buf.WriteString(" (") - node.Expr.formatFast(buf) + node.Expr.FormatFast(buf) buf.WriteByte(')') } else { buf.WriteString(" columns ") - node.ColList.formatFast(buf) + node.ColList.FormatFast(buf) } } @@ -787,7 +787,7 @@ func (node *PartitionOption) formatFast(buf *TrackedBuffer) { } if node.SubPartition != nil { buf.WriteByte(' ') - node.SubPartition.formatFast(buf) + node.SubPartition.FormatFast(buf) } if node.Definitions != nil { buf.WriteString("\n(") @@ -795,14 +795,14 @@ func (node *PartitionOption) formatFast(buf *TrackedBuffer) { if i != 0 { buf.WriteString(",\n ") } - pd.formatFast(buf) + pd.FormatFast(buf) } buf.WriteByte(')') } } -// formatFast formats the node. -func (node *SubPartition) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *SubPartition) FormatFast(buf *TrackedBuffer) { buf.WriteString("subpartition by") if node.IsLinear { buf.WriteString(" linear") @@ -811,7 +811,7 @@ func (node *SubPartition) formatFast(buf *TrackedBuffer) { switch node.Type { case HashType: buf.WriteString(" hash (") - node.Expr.formatFast(buf) + node.Expr.FormatFast(buf) buf.WriteByte(')') case KeyType: buf.WriteString(" key") @@ -823,7 +823,7 @@ func (node *SubPartition) formatFast(buf *TrackedBuffer) { buf.WriteString(" ()") } else { buf.WriteByte(' ') - node.ColList.formatFast(buf) + node.ColList.FormatFast(buf) } } @@ -833,25 +833,25 @@ func (node *SubPartition) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (ts *TableSpec) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (ts *TableSpec) FormatFast(buf *TrackedBuffer) { buf.WriteString("(\n") for i, col := range ts.Columns { if i == 0 { buf.WriteByte('\t') - col.formatFast(buf) + col.FormatFast(buf) } else { buf.WriteString(",\n\t") - col.formatFast(buf) + col.FormatFast(buf) } } for _, idx := range ts.Indexes { buf.WriteString(",\n\t") - idx.formatFast(buf) + idx.FormatFast(buf) } for _, c := range ts.Constraints { buf.WriteString(",\n\t") - c.formatFast(buf) + c.FormatFast(buf) } buf.WriteString("\n)") @@ -871,39 +871,39 @@ func (ts *TableSpec) formatFast(buf *TrackedBuffer) { } } else if opt.Value != nil { buf.WriteByte(' ') - opt.Value.formatFast(buf) + opt.Value.FormatFast(buf) } else { buf.WriteString(" (") - opt.Tables.formatFast(buf) + opt.Tables.FormatFast(buf) buf.WriteByte(')') } } if ts.PartitionOption != nil { - ts.PartitionOption.formatFast(buf) + ts.PartitionOption.FormatFast(buf) } } -// formatFast formats the node. -func (col *ColumnDefinition) formatFast(buf *TrackedBuffer) { - col.Name.formatFast(buf) +// FormatFast formats the node. +func (col *ColumnDefinition) FormatFast(buf *TrackedBuffer) { + col.Name.FormatFast(buf) buf.WriteByte(' ') - col.Type.formatFast(buf) + col.Type.FormatFast(buf) } -// formatFast returns a canonical string representation of the type and all relevant options -func (ct *ColumnType) formatFast(buf *TrackedBuffer) { +// FormatFast returns a canonical string representation of the type and all relevant options +func (ct *ColumnType) FormatFast(buf *TrackedBuffer) { buf.WriteString(ct.Type) if ct.Length != nil && ct.Scale != nil { buf.WriteByte('(') - ct.Length.formatFast(buf) + ct.Length.FormatFast(buf) buf.WriteByte(',') - ct.Scale.formatFast(buf) + ct.Scale.FormatFast(buf) buf.WriteByte(')') } else if ct.Length != nil { buf.WriteByte('(') - ct.Length.formatFast(buf) + ct.Length.FormatFast(buf) buf.WriteByte(')') } @@ -961,10 +961,10 @@ func (ct *ColumnType) formatFast(buf *TrackedBuffer) { buf.WriteString(keywordStrings[DEFAULT]) if ct.Options.DefaultLiteral { buf.WriteByte(' ') - ct.Options.Default.formatFast(buf) + ct.Options.Default.FormatFast(buf) } else { buf.WriteString(" (") - ct.Options.Default.formatFast(buf) + ct.Options.Default.FormatFast(buf) buf.WriteByte(')') } } @@ -974,13 +974,13 @@ func (ct *ColumnType) formatFast(buf *TrackedBuffer) { buf.WriteByte(' ') buf.WriteString(keywordStrings[UPDATE]) buf.WriteByte(' ') - ct.Options.OnUpdate.formatFast(buf) + ct.Options.OnUpdate.FormatFast(buf) } if ct.Options.As != nil { buf.WriteByte(' ') buf.WriteString(keywordStrings[AS]) buf.WriteString(" (") - ct.Options.As.formatFast(buf) + ct.Options.As.FormatFast(buf) buf.WriteByte(')') if ct.Options.Storage == VirtualStorage { @@ -1010,7 +1010,7 @@ func (ct *ColumnType) formatFast(buf *TrackedBuffer) { buf.WriteByte(' ') buf.WriteString(keywordStrings[COMMENT_KEYWORD]) buf.WriteByte(' ') - ct.Options.Comment.formatFast(buf) + ct.Options.Comment.FormatFast(buf) } if ct.Options.Invisible != nil { if *ct.Options.Invisible { @@ -1031,13 +1031,13 @@ func (ct *ColumnType) formatFast(buf *TrackedBuffer) { buf.WriteByte(' ') buf.WriteString(keywordStrings[ENGINE_ATTRIBUTE]) buf.WriteByte(' ') - ct.Options.EngineAttribute.formatFast(buf) + ct.Options.EngineAttribute.FormatFast(buf) } if ct.Options.SecondaryEngineAttribute != nil { buf.WriteByte(' ') buf.WriteString(keywordStrings[SECONDARY_ENGINE_ATTRIBUTE]) buf.WriteByte(' ') - ct.Options.SecondaryEngineAttribute.formatFast(buf) + ct.Options.SecondaryEngineAttribute.FormatFast(buf) } if ct.Options.KeyOpt == ColKeyPrimary { buf.WriteByte(' ') @@ -1073,20 +1073,20 @@ func (ct *ColumnType) formatFast(buf *TrackedBuffer) { } if ct.Options.Reference != nil { buf.WriteByte(' ') - ct.Options.Reference.formatFast(buf) + ct.Options.Reference.FormatFast(buf) } if ct.Options.SRID != nil { buf.WriteByte(' ') buf.WriteString(keywordStrings[SRID]) buf.WriteByte(' ') - ct.Options.SRID.formatFast(buf) + ct.Options.SRID.FormatFast(buf) } } } -// formatFast formats the node. -func (idx *IndexDefinition) formatFast(buf *TrackedBuffer) { - idx.Info.formatFast(buf) +// FormatFast formats the node. +func (idx *IndexDefinition) FormatFast(buf *TrackedBuffer) { + idx.Info.FormatFast(buf) buf.WriteString(" (") for i, col := range idx.Columns { if i != 0 { @@ -1094,13 +1094,13 @@ func (idx *IndexDefinition) formatFast(buf *TrackedBuffer) { } if col.Expression != nil { buf.WriteByte('(') - col.Expression.formatFast(buf) + col.Expression.FormatFast(buf) buf.WriteByte(')') } else { - col.Column.formatFast(buf) + col.Column.FormatFast(buf) if col.Length != nil { buf.WriteByte('(') - col.Length.formatFast(buf) + col.Length.FormatFast(buf) buf.WriteByte(')') } } @@ -1118,16 +1118,16 @@ func (idx *IndexDefinition) formatFast(buf *TrackedBuffer) { buf.WriteString(opt.String) } else if opt.Value != nil { buf.WriteByte(' ') - opt.Value.formatFast(buf) + opt.Value.FormatFast(buf) } } } -// formatFast formats the node. -func (ii *IndexInfo) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (ii *IndexInfo) FormatFast(buf *TrackedBuffer) { if !ii.ConstraintName.IsEmpty() { buf.WriteString("constraint ") - ii.ConstraintName.formatFast(buf) + ii.ConstraintName.FormatFast(buf) buf.WriteByte(' ') } switch ii.Type { @@ -1153,24 +1153,24 @@ func (ii *IndexInfo) formatFast(buf *TrackedBuffer) { } if !ii.Name.IsEmpty() { buf.WriteByte(' ') - ii.Name.formatFast(buf) + ii.Name.FormatFast(buf) } } -// formatFast formats the node. -func (node *AutoIncSpec) formatFast(buf *TrackedBuffer) { - node.Column.formatFast(buf) +// FormatFast formats the node. +func (node *AutoIncSpec) FormatFast(buf *TrackedBuffer) { + node.Column.FormatFast(buf) buf.WriteByte(' ') buf.WriteString("using ") - node.Sequence.formatFast(buf) + node.Sequence.FormatFast(buf) } -// formatFast formats the node. The "CREATE VINDEX" preamble was formatted in +// FormatFast formats the node. The "CREATE VINDEX" preamble was formatted in // the containing DDL node Format, so this just prints the type, any // parameters, and optionally the owner -func (node *VindexSpec) formatFast(buf *TrackedBuffer) { +func (node *VindexSpec) FormatFast(buf *TrackedBuffer) { buf.WriteString("using ") - node.Type.formatFast(buf) + node.Type.FormatFast(buf) numParams := len(node.Params) if numParams != 0 { @@ -1179,30 +1179,30 @@ func (node *VindexSpec) formatFast(buf *TrackedBuffer) { if i != 0 { buf.WriteString(", ") } - p.formatFast(buf) + p.FormatFast(buf) } } } -// formatFast formats the node. -func (node VindexParam) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node VindexParam) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.Key.String()) buf.WriteByte('=') buf.WriteString(node.Val) } -// formatFast formats the node. -func (c *ConstraintDefinition) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (c *ConstraintDefinition) FormatFast(buf *TrackedBuffer) { if !c.Name.IsEmpty() { buf.WriteString("constraint ") - c.Name.formatFast(buf) + c.Name.FormatFast(buf) buf.WriteByte(' ') } c.Details.Format(buf) } -// formatFast formats the node. -func (a ReferenceAction) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (a ReferenceAction) FormatFast(buf *TrackedBuffer) { switch a { case Restrict: buf.WriteString("restrict") @@ -1217,8 +1217,8 @@ func (a ReferenceAction) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (a MatchAction) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (a MatchAction) FormatFast(buf *TrackedBuffer) { switch a { case Full: buf.WriteString("full") @@ -1229,52 +1229,52 @@ func (a MatchAction) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (f *ForeignKeyDefinition) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (f *ForeignKeyDefinition) FormatFast(buf *TrackedBuffer) { buf.WriteString("foreign key ") - f.IndexName.formatFast(buf) - f.Source.formatFast(buf) + f.IndexName.FormatFast(buf) + f.Source.FormatFast(buf) buf.WriteByte(' ') - f.ReferenceDefinition.formatFast(buf) + f.ReferenceDefinition.FormatFast(buf) } -// formatFast formats the node. -func (ref *ReferenceDefinition) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (ref *ReferenceDefinition) FormatFast(buf *TrackedBuffer) { buf.WriteString("references ") - ref.ReferencedTable.formatFast(buf) + ref.ReferencedTable.FormatFast(buf) buf.WriteByte(' ') - ref.ReferencedColumns.formatFast(buf) + ref.ReferencedColumns.FormatFast(buf) if ref.Match != DefaultMatch { buf.WriteString(" match ") - ref.Match.formatFast(buf) + ref.Match.FormatFast(buf) } if ref.OnDelete != DefaultAction { buf.WriteString(" on delete ") - ref.OnDelete.formatFast(buf) + ref.OnDelete.FormatFast(buf) } if ref.OnUpdate != DefaultAction { buf.WriteString(" on update ") - ref.OnUpdate.formatFast(buf) + ref.OnUpdate.FormatFast(buf) } } -// formatFast formats the node. -func (c *CheckConstraintDefinition) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (c *CheckConstraintDefinition) FormatFast(buf *TrackedBuffer) { buf.WriteString("check (") - c.Expr.formatFast(buf) + c.Expr.FormatFast(buf) buf.WriteByte(')') if !c.Enforced { buf.WriteString(" not enforced") } } -// formatFast formats the node. -func (node *Show) formatFast(buf *TrackedBuffer) { - node.Internal.formatFast(buf) +// FormatFast formats the node. +func (node *Show) FormatFast(buf *TrackedBuffer) { + node.Internal.FormatFast(buf) } -// formatFast formats the node. -func (node *ShowFilter) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *ShowFilter) FormatFast(buf *TrackedBuffer) { if node == nil { return } @@ -1283,27 +1283,27 @@ func (node *ShowFilter) formatFast(buf *TrackedBuffer) { sqltypes.BufEncodeStringSQL(buf.Builder, node.Like) } else { buf.WriteString(" where ") - node.Filter.formatFast(buf) + node.Filter.FormatFast(buf) } } -// formatFast formats the node. -func (node *Use) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Use) FormatFast(buf *TrackedBuffer) { if node.DBName.v != "" { buf.WriteString("use ") - node.DBName.formatFast(buf) + node.DBName.FormatFast(buf) } else { buf.WriteString("use") } } -// formatFast formats the node. -func (node *Commit) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Commit) FormatFast(buf *TrackedBuffer) { buf.WriteString("commit") } -// formatFast formats the node. -func (node *Begin) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Begin) FormatFast(buf *TrackedBuffer) { if node.TxAccessModes == nil { buf.WriteString("begin") return @@ -1321,31 +1321,31 @@ func (node *Begin) formatFast(buf *TrackedBuffer) { } -// formatFast formats the node. -func (node *Rollback) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Rollback) FormatFast(buf *TrackedBuffer) { buf.WriteString("rollback") } -// formatFast formats the node. -func (node *SRollback) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *SRollback) FormatFast(buf *TrackedBuffer) { buf.WriteString("rollback to ") - node.Name.formatFast(buf) + node.Name.FormatFast(buf) } -// formatFast formats the node. -func (node *Savepoint) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Savepoint) FormatFast(buf *TrackedBuffer) { buf.WriteString("savepoint ") - node.Name.formatFast(buf) + node.Name.FormatFast(buf) } -// formatFast formats the node. -func (node *Release) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Release) FormatFast(buf *TrackedBuffer) { buf.WriteString("release savepoint ") - node.Name.formatFast(buf) + node.Name.FormatFast(buf) } -// formatFast formats the node. -func (node *ExplainStmt) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *ExplainStmt) FormatFast(buf *TrackedBuffer) { format := "" switch node.Type { case EmptyType: @@ -1355,91 +1355,91 @@ func (node *ExplainStmt) formatFast(buf *TrackedBuffer) { format = "format = " + node.Type.ToString() + " " } buf.WriteString("explain ") - node.Comments.formatFast(buf) + node.Comments.FormatFast(buf) buf.WriteString(format) - node.Statement.formatFast(buf) + node.Statement.FormatFast(buf) } -// formatFast formats the node. -func (node *VExplainStmt) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *VExplainStmt) FormatFast(buf *TrackedBuffer) { buf.WriteString("vexplain ") - node.Comments.formatFast(buf) + node.Comments.FormatFast(buf) buf.WriteString(node.Type.ToString()) buf.WriteByte(' ') - node.Statement.formatFast(buf) + node.Statement.FormatFast(buf) } -// formatFast formats the node. -func (node *ExplainTab) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *ExplainTab) FormatFast(buf *TrackedBuffer) { buf.WriteString("explain ") - node.Table.formatFast(buf) + node.Table.FormatFast(buf) if node.Wild != "" { buf.WriteByte(' ') buf.WriteString(node.Wild) } } -// formatFast formats the node. -func (node *PrepareStmt) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *PrepareStmt) FormatFast(buf *TrackedBuffer) { buf.WriteString("prepare ") - node.Comments.formatFast(buf) - node.Name.formatFast(buf) + node.Comments.FormatFast(buf) + node.Name.FormatFast(buf) buf.WriteString(" from ") if node.Statement != nil { - node.Statement.formatFast(buf) + node.Statement.FormatFast(buf) } } -// formatFast formats the node. -func (node *ExecuteStmt) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *ExecuteStmt) FormatFast(buf *TrackedBuffer) { buf.WriteString("execute ") - node.Comments.formatFast(buf) - node.Name.formatFast(buf) + node.Comments.FormatFast(buf) + node.Name.FormatFast(buf) if len(node.Arguments) > 0 { buf.WriteString(" using ") } var prefix string for _, n := range node.Arguments { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } -// formatFast formats the node. -func (node *DeallocateStmt) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *DeallocateStmt) FormatFast(buf *TrackedBuffer) { buf.WriteString("deallocate ") - node.Comments.formatFast(buf) + node.Comments.FormatFast(buf) buf.WriteString("prepare ") - node.Name.formatFast(buf) + node.Name.FormatFast(buf) } -// formatFast formats the node. -func (node *CallProc) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *CallProc) FormatFast(buf *TrackedBuffer) { buf.WriteString("call ") - node.Name.formatFast(buf) + node.Name.FormatFast(buf) buf.WriteByte('(') - node.Params.formatFast(buf) + node.Params.FormatFast(buf) buf.WriteByte(')') } -// formatFast formats the node. -func (node *Analyze) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Analyze) FormatFast(buf *TrackedBuffer) { buf.WriteString("analyze ") if node.IsLocal { buf.WriteString("local ") } buf.WriteString("table ") - node.Table.formatFast(buf) + node.Table.FormatFast(buf) } -// formatFast formats the node. -func (node *OtherAdmin) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *OtherAdmin) FormatFast(buf *TrackedBuffer) { buf.WriteString("otheradmin") } -// formatFast formats the node. -func (node *ParsedComments) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *ParsedComments) FormatFast(buf *TrackedBuffer) { if node == nil { return } @@ -1449,43 +1449,43 @@ func (node *ParsedComments) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (node SelectExprs) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node SelectExprs) FormatFast(buf *TrackedBuffer) { var prefix string for _, n := range node { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } -// formatFast formats the node. -func (node *StarExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *StarExpr) FormatFast(buf *TrackedBuffer) { if !node.TableName.IsEmpty() { - node.TableName.formatFast(buf) + node.TableName.FormatFast(buf) buf.WriteByte('.') } buf.WriteByte('*') } -// formatFast formats the node. -func (node *AliasedExpr) formatFast(buf *TrackedBuffer) { - node.Expr.formatFast(buf) +// FormatFast formats the node. +func (node *AliasedExpr) FormatFast(buf *TrackedBuffer) { + node.Expr.FormatFast(buf) if !node.As.IsEmpty() { buf.WriteString(" as ") - node.As.formatFast(buf) + node.As.FormatFast(buf) } } -// formatFast formats the node. -func (node *Nextval) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Nextval) FormatFast(buf *TrackedBuffer) { buf.WriteString("next ") - node.Expr.formatFast(buf) + node.Expr.FormatFast(buf) buf.WriteString(" values") } -// formatFast formats the node. -func (node Columns) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node Columns) FormatFast(buf *TrackedBuffer) { if node == nil { return } @@ -1493,116 +1493,116 @@ func (node Columns) formatFast(buf *TrackedBuffer) { prefix := "" for _, n := range node { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } buf.WriteByte(')') } -// formatFast formats the node -func (node Partitions) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node Partitions) FormatFast(buf *TrackedBuffer) { if node == nil { return } prefix := " partition (" for _, n := range node { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } buf.WriteByte(')') } -// formatFast formats the node. -func (node TableExprs) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node TableExprs) FormatFast(buf *TrackedBuffer) { var prefix string for _, n := range node { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } -// formatFast formats the node. -func (node *AliasedTableExpr) formatFast(buf *TrackedBuffer) { - node.Expr.formatFast(buf) - node.Partitions.formatFast(buf) +// FormatFast formats the node. +func (node *AliasedTableExpr) FormatFast(buf *TrackedBuffer) { + node.Expr.FormatFast(buf) + node.Partitions.FormatFast(buf) if !node.As.IsEmpty() { buf.WriteString(" as ") - node.As.formatFast(buf) + node.As.FormatFast(buf) if len(node.Columns) != 0 { - node.Columns.formatFast(buf) + node.Columns.FormatFast(buf) } } if node.Hints != nil { // Hint node provides the space padding. - node.Hints.formatFast(buf) + node.Hints.FormatFast(buf) } } -// formatFast formats the node. -func (node TableNames) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node TableNames) FormatFast(buf *TrackedBuffer) { var prefix string for _, n := range node { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } -// formatFast formats the node. -func (node TableName) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node TableName) FormatFast(buf *TrackedBuffer) { if node.IsEmpty() { return } if !node.Qualifier.IsEmpty() { - node.Qualifier.formatFast(buf) + node.Qualifier.FormatFast(buf) buf.WriteByte('.') } - node.Name.formatFast(buf) + node.Name.FormatFast(buf) } -// formatFast formats the node. -func (node *ParenTableExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *ParenTableExpr) FormatFast(buf *TrackedBuffer) { buf.WriteByte('(') - node.Exprs.formatFast(buf) + node.Exprs.FormatFast(buf) buf.WriteByte(')') } -// formatFast formats the node. -func (node *JoinCondition) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *JoinCondition) FormatFast(buf *TrackedBuffer) { if node == nil { return } if node.On != nil { buf.WriteString(" on ") - node.On.formatFast(buf) + node.On.FormatFast(buf) } if node.Using != nil { buf.WriteString(" using ") - node.Using.formatFast(buf) + node.Using.FormatFast(buf) } } -// formatFast formats the node. -func (node *JoinTableExpr) formatFast(buf *TrackedBuffer) { - node.LeftExpr.formatFast(buf) +// FormatFast formats the node. +func (node *JoinTableExpr) FormatFast(buf *TrackedBuffer) { + node.LeftExpr.FormatFast(buf) buf.WriteByte(' ') buf.WriteString(node.Join.ToString()) buf.WriteByte(' ') - node.RightExpr.formatFast(buf) - node.Condition.formatFast(buf) + node.RightExpr.FormatFast(buf) + node.Condition.FormatFast(buf) } -// formatFast formats the node. -func (node IndexHints) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node IndexHints) FormatFast(buf *TrackedBuffer) { for _, n := range node { - n.formatFast(buf) + n.FormatFast(buf) } } -// formatFast formats the node. -func (node *IndexHint) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *IndexHint) FormatFast(buf *TrackedBuffer) { buf.WriteByte(' ') buf.WriteString(node.Type.ToString()) buf.WriteString("index ") @@ -1617,63 +1617,63 @@ func (node *IndexHint) formatFast(buf *TrackedBuffer) { prefix := "(" for _, n := range node.Indexes { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } buf.WriteByte(')') } } -// formatFast formats the node. -func (node *Where) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Where) FormatFast(buf *TrackedBuffer) { if node == nil || node.Expr == nil { return } buf.WriteByte(' ') buf.WriteString(node.Type.ToString()) buf.WriteByte(' ') - node.Expr.formatFast(buf) + node.Expr.FormatFast(buf) } -// formatFast formats the node. -func (node Exprs) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node Exprs) FormatFast(buf *TrackedBuffer) { var prefix string for _, n := range node { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } -// formatFast formats the node. -func (node *AndExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *AndExpr) FormatFast(buf *TrackedBuffer) { buf.printExpr(node, node.Left, true) buf.WriteString(" and ") buf.printExpr(node, node.Right, false) } -// formatFast formats the node. -func (node *OrExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *OrExpr) FormatFast(buf *TrackedBuffer) { buf.printExpr(node, node.Left, true) buf.WriteString(" or ") buf.printExpr(node, node.Right, false) } -// formatFast formats the node. -func (node *XorExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *XorExpr) FormatFast(buf *TrackedBuffer) { buf.printExpr(node, node.Left, true) buf.WriteString(" xor ") buf.printExpr(node, node.Right, false) } -// formatFast formats the node. -func (node *NotExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *NotExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("not ") buf.printExpr(node, node.Expr, true) } -// formatFast formats the node. -func (node *ComparisonExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *ComparisonExpr) FormatFast(buf *TrackedBuffer) { buf.printExpr(node, node.Left, true) buf.WriteByte(' ') buf.WriteString(node.Operator.ToString()) @@ -1685,8 +1685,8 @@ func (node *ComparisonExpr) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (node *BetweenExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *BetweenExpr) FormatFast(buf *TrackedBuffer) { if node.IsBetween { buf.printExpr(node, node.Left, true) buf.WriteString(" between ") @@ -1702,28 +1702,28 @@ func (node *BetweenExpr) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (node *IsExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *IsExpr) FormatFast(buf *TrackedBuffer) { buf.printExpr(node, node.Left, true) buf.WriteByte(' ') buf.WriteString(node.Right.ToString()) } -// formatFast formats the node. -func (node *ExistsExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *ExistsExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("exists ") buf.printExpr(node, node.Subquery, true) } -// formatFast formats the node. -func (node *AssignmentExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *AssignmentExpr) FormatFast(buf *TrackedBuffer) { buf.printExpr(node, node.Left, true) buf.WriteString(" := ") buf.printExpr(node, node.Right, false) } -// formatFast formats the node. -func (node *Literal) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Literal) FormatFast(buf *TrackedBuffer) { switch node.Type { case StrVal: sqltypes.MakeTrusted(sqltypes.VarBinary, node.Bytes()).EncodeSQL(buf) @@ -1754,8 +1754,8 @@ func (node *Literal) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (node *Argument) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Argument) FormatFast(buf *TrackedBuffer) { buf.WriteArg(":", node.Name) if node.Type >= 0 { // For bind variables that are statically typed, emit their type as an adjacent comment. @@ -1767,13 +1767,13 @@ func (node *Argument) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (node *NullVal) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *NullVal) FormatFast(buf *TrackedBuffer) { buf.WriteString("null") } -// formatFast formats the node. -func (node BoolVal) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node BoolVal) FormatFast(buf *TrackedBuffer) { if node { buf.WriteString("true") } else { @@ -1781,46 +1781,46 @@ func (node BoolVal) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (node *ColName) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *ColName) FormatFast(buf *TrackedBuffer) { if !node.Qualifier.IsEmpty() { - node.Qualifier.formatFast(buf) + node.Qualifier.FormatFast(buf) buf.WriteByte('.') } - node.Name.formatFast(buf) + node.Name.FormatFast(buf) } -// formatFast formats the node. -func (node ValTuple) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node ValTuple) FormatFast(buf *TrackedBuffer) { buf.WriteByte('(') - Exprs(node).formatFast(buf) + Exprs(node).FormatFast(buf) buf.WriteByte(')') } -// formatFast formats the node. -func (node *Subquery) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Subquery) FormatFast(buf *TrackedBuffer) { buf.WriteByte('(') - node.Select.formatFast(buf) + node.Select.FormatFast(buf) buf.WriteByte(')') } -// formatFast formats the node. -func (node *DerivedTable) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *DerivedTable) FormatFast(buf *TrackedBuffer) { if node.Lateral { buf.WriteString("lateral ") } buf.WriteByte('(') - node.Select.formatFast(buf) + node.Select.FormatFast(buf) buf.WriteByte(')') } -// formatFast formats the node. -func (node ListArg) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node ListArg) FormatFast(buf *TrackedBuffer) { buf.WriteArg("::", string(node)) } -// formatFast formats the node. -func (node *BinaryExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *BinaryExpr) FormatFast(buf *TrackedBuffer) { buf.printExpr(node, node.Left, true) buf.WriteByte(' ') buf.WriteString(node.Operator.ToString()) @@ -1828,8 +1828,8 @@ func (node *BinaryExpr) formatFast(buf *TrackedBuffer) { buf.printExpr(node, node.Right, false) } -// formatFast formats the node. -func (node *UnaryExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *UnaryExpr) FormatFast(buf *TrackedBuffer) { if _, unary := node.Expr.(*UnaryExpr); unary { // They have same precedence so parenthesis is not required. buf.WriteString(node.Operator.ToString()) @@ -1841,15 +1841,15 @@ func (node *UnaryExpr) formatFast(buf *TrackedBuffer) { buf.printExpr(node, node.Expr, true) } -// formatFast formats the node. -func (node *IntroducerExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *IntroducerExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.CharacterSet) buf.WriteByte(' ') buf.printExpr(node, node.Expr, true) } -// formatFast formats the node. -func (node *TimestampDiffExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *TimestampDiffExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("timestampdiff(") buf.WriteString(node.Unit.ToString()) buf.WriteString(", ") @@ -1859,8 +1859,8 @@ func (node *TimestampDiffExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node. -func (node *ExtractFuncExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *ExtractFuncExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("extract(") buf.WriteString(node.IntervalType.ToString()) buf.WriteString(" from ") @@ -1868,8 +1868,8 @@ func (node *ExtractFuncExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *RegexpInstrExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *RegexpInstrExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("regexp_instr(") buf.printExpr(node, node.Expr, true) buf.WriteString(", ") @@ -1893,8 +1893,8 @@ func (node *RegexpInstrExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *RegexpLikeExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *RegexpLikeExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("regexp_like(") buf.printExpr(node, node.Expr, true) buf.WriteString(", ") @@ -1906,8 +1906,8 @@ func (node *RegexpLikeExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *RegexpReplaceExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *RegexpReplaceExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("regexp_replace(") buf.printExpr(node, node.Expr, true) buf.WriteString(", ") @@ -1929,8 +1929,8 @@ func (node *RegexpReplaceExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *RegexpSubstrExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *RegexpSubstrExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("regexp_substr(") buf.printExpr(node, node.Expr, true) buf.WriteString(", ") @@ -1950,8 +1950,8 @@ func (node *RegexpSubstrExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *IntervalDateExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *IntervalDateExpr) FormatFast(buf *TrackedBuffer) { switch node.Syntax { case IntervalDateExprAdddate, IntervalDateExprSubdate: if node.Unit == IntervalNone { @@ -2003,8 +2003,8 @@ func (node *IntervalDateExpr) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (node *TrimFuncExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *TrimFuncExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.TrimFuncType.ToString()) buf.WriteByte('(') if node.TrimFuncType == NormalTrimType { @@ -2028,13 +2028,13 @@ func (node *TrimFuncExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node. -func (node *WeightStringFuncExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *WeightStringFuncExpr) FormatFast(buf *TrackedBuffer) { if node.As != nil { buf.WriteString("weight_string(") buf.printExpr(node, node.Expr, true) buf.WriteString(" as ") - node.As.formatFast(buf) + node.As.FormatFast(buf) buf.WriteByte(')') } else { buf.WriteString("weight_string(") @@ -2043,8 +2043,8 @@ func (node *WeightStringFuncExpr) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (node *CurTimeFuncExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *CurTimeFuncExpr) FormatFast(buf *TrackedBuffer) { if node.Fsp > 0 { buf.WriteString(node.Name.String()) buf.WriteByte('(') @@ -2056,17 +2056,17 @@ func (node *CurTimeFuncExpr) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (node *CollateExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *CollateExpr) FormatFast(buf *TrackedBuffer) { buf.printExpr(node, node.Expr, true) buf.WriteString(" collate ") buf.WriteString(node.Collation) } -// formatFast formats the node. -func (node *FuncExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *FuncExpr) FormatFast(buf *TrackedBuffer) { if !node.Qualifier.IsEmpty() { - node.Qualifier.formatFast(buf) + node.Qualifier.FormatFast(buf) buf.WriteByte('.') } // Function names should not be back-quoted even @@ -2079,21 +2079,21 @@ func (node *FuncExpr) formatFast(buf *TrackedBuffer) { buf.WriteString(funcName) } buf.WriteByte('(') - node.Exprs.formatFast(buf) + node.Exprs.FormatFast(buf) buf.WriteByte(')') } -// formatFast formats the node -func (node *GroupConcatExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *GroupConcatExpr) FormatFast(buf *TrackedBuffer) { if node.Distinct { buf.WriteString("group_concat(") buf.WriteString(DistinctStr) - node.Exprs.formatFast(buf) - node.OrderBy.formatFast(buf) + node.Exprs.FormatFast(buf) + node.OrderBy.FormatFast(buf) } else { buf.WriteString("group_concat(") - node.Exprs.formatFast(buf) - node.OrderBy.formatFast(buf) + node.Exprs.FormatFast(buf) + node.OrderBy.FormatFast(buf) } if node.Separator != "" { buf.WriteByte(' ') @@ -2101,173 +2101,173 @@ func (node *GroupConcatExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(' ') buf.WriteString(node.Separator) } - node.Limit.formatFast(buf) + node.Limit.FormatFast(buf) buf.WriteByte(')') } -// formatFast formats the node. -func (node *ValuesFuncExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *ValuesFuncExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("values(") buf.printExpr(node, node.Name, true) buf.WriteByte(')') } -// formatFast formats the node -func (node *JSONPrettyExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *JSONPrettyExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("json_pretty(") buf.printExpr(node, node.JSONVal, true) buf.WriteByte(')') } -// formatFast formats the node -func (node *JSONStorageFreeExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *JSONStorageFreeExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("json_storage_free(") buf.printExpr(node, node.JSONVal, true) buf.WriteByte(')') } -// formatFast formats the node -func (node *JSONStorageSizeExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *JSONStorageSizeExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("json_storage_size(") buf.printExpr(node, node.JSONVal, true) buf.WriteByte(')') } -// formatFast formats the node -func (node *OverClause) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *OverClause) FormatFast(buf *TrackedBuffer) { buf.WriteString("over") if !node.WindowName.IsEmpty() { buf.WriteByte(' ') - node.WindowName.formatFast(buf) + node.WindowName.FormatFast(buf) } if node.WindowSpec != nil { buf.WriteString(" (") - node.WindowSpec.formatFast(buf) + node.WindowSpec.FormatFast(buf) buf.WriteByte(')') } } -// formatFast formats the node -func (node *WindowSpecification) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *WindowSpecification) FormatFast(buf *TrackedBuffer) { if !node.Name.IsEmpty() { buf.WriteByte(' ') - node.Name.formatFast(buf) + node.Name.FormatFast(buf) } if node.PartitionClause != nil { buf.WriteString(" partition by ") - node.PartitionClause.formatFast(buf) + node.PartitionClause.FormatFast(buf) } if node.OrderClause != nil { - node.OrderClause.formatFast(buf) + node.OrderClause.FormatFast(buf) } if node.FrameClause != nil { - node.FrameClause.formatFast(buf) + node.FrameClause.FormatFast(buf) } } -// formatFast formats the node -func (node *FrameClause) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *FrameClause) FormatFast(buf *TrackedBuffer) { buf.WriteByte(' ') buf.WriteString(node.Unit.ToString()) if node.End != nil { buf.WriteString(" between") - node.Start.formatFast(buf) + node.Start.FormatFast(buf) buf.WriteString(" and") - node.End.formatFast(buf) + node.End.FormatFast(buf) } else { - node.Start.formatFast(buf) + node.Start.FormatFast(buf) } } -// formatFast formats the node -func (node *NullTreatmentClause) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *NullTreatmentClause) FormatFast(buf *TrackedBuffer) { buf.WriteByte(' ') buf.WriteString(node.Type.ToString()) } -// formatFast formats the node -func (node *FromFirstLastClause) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *FromFirstLastClause) FormatFast(buf *TrackedBuffer) { buf.WriteByte(' ') buf.WriteString(node.Type.ToString()) } -// formatFast formats the node -func (node *FramePoint) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *FramePoint) FormatFast(buf *TrackedBuffer) { if node.Expr != nil { if node.Unit != IntervalNone { buf.WriteString(" interval ") - node.Expr.formatFast(buf) + node.Expr.FormatFast(buf) buf.WriteByte(' ') buf.WriteString(node.Unit.ToString()) } else { buf.WriteByte(' ') - node.Expr.formatFast(buf) + node.Expr.FormatFast(buf) } } buf.WriteByte(' ') buf.WriteString(node.Type.ToString()) } -// formatFast formats the node -func (node *ArgumentLessWindowExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *ArgumentLessWindowExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.Type.ToString()) buf.WriteString("()") if node.OverClause != nil { buf.WriteByte(' ') - node.OverClause.formatFast(buf) + node.OverClause.FormatFast(buf) } } -// formatFast formats the node -func (node *FirstOrLastValueExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *FirstOrLastValueExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.Type.ToString()) buf.WriteByte('(') buf.printExpr(node, node.Expr, true) buf.WriteByte(')') if node.NullTreatmentClause != nil { - node.NullTreatmentClause.formatFast(buf) + node.NullTreatmentClause.FormatFast(buf) } if node.OverClause != nil { buf.WriteByte(' ') - node.OverClause.formatFast(buf) + node.OverClause.FormatFast(buf) } } -// formatFast formats the node -func (node *NtileExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *NtileExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("ntile(") buf.printExpr(node, node.N, true) buf.WriteString(")") if node.OverClause != nil { buf.WriteByte(' ') - node.OverClause.formatFast(buf) + node.OverClause.FormatFast(buf) } } -// formatFast formats the node -func (node *NTHValueExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *NTHValueExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("nth_value(") buf.printExpr(node, node.Expr, true) buf.WriteString(", ") buf.printExpr(node, node.N, true) buf.WriteString(")") if node.FromFirstLastClause != nil { - node.FromFirstLastClause.formatFast(buf) + node.FromFirstLastClause.FormatFast(buf) } if node.NullTreatmentClause != nil { - node.NullTreatmentClause.formatFast(buf) + node.NullTreatmentClause.FormatFast(buf) } if node.OverClause != nil { buf.WriteByte(' ') - node.OverClause.formatFast(buf) + node.OverClause.FormatFast(buf) } } -// formatFast formats the node -func (node *LagLeadExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *LagLeadExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.Type.ToString()) buf.WriteByte('(') buf.printExpr(node, node.Expr, true) @@ -2281,16 +2281,16 @@ func (node *LagLeadExpr) formatFast(buf *TrackedBuffer) { } buf.WriteString(")") if node.NullTreatmentClause != nil { - node.NullTreatmentClause.formatFast(buf) + node.NullTreatmentClause.FormatFast(buf) } if node.OverClause != nil { buf.WriteByte(' ') - node.OverClause.formatFast(buf) + node.OverClause.FormatFast(buf) } } -// formatFast formats the node -func (node *ExtractValueExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *ExtractValueExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("extractvalue(") buf.printExpr(node, node.Fragment, true) buf.WriteString(", ") @@ -2298,8 +2298,8 @@ func (node *ExtractValueExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *UpdateXMLExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *UpdateXMLExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("updatexml(") buf.printExpr(node, node.Target, true) buf.WriteString(", ") @@ -2309,7 +2309,7 @@ func (node *UpdateXMLExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -func (node *PerformanceSchemaFuncExpr) formatFast(buf *TrackedBuffer) { +func (node *PerformanceSchemaFuncExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.Type.ToString()) buf.WriteByte('(') if node.Argument != nil { @@ -2318,8 +2318,8 @@ func (node *PerformanceSchemaFuncExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *GTIDFuncExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *GTIDFuncExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.Type.ToString()) buf.WriteByte('(') buf.printExpr(node, node.Set1, true) @@ -2338,8 +2338,8 @@ func (node *GTIDFuncExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node. -func (node *SubstrExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *SubstrExpr) FormatFast(buf *TrackedBuffer) { if node.To == nil { buf.WriteString("substr(") buf.printExpr(node, node.Name, true) @@ -2357,8 +2357,8 @@ func (node *SubstrExpr) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (node *InsertExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *InsertExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("insert(") buf.printExpr(node, node.Str, true) buf.WriteString(", ") @@ -2370,17 +2370,17 @@ func (node *InsertExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node. -func (node *IntervalFuncExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *IntervalFuncExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("interval(") buf.printExpr(node, node.Expr, true) buf.WriteString(", ") - node.Exprs.formatFast(buf) + node.Exprs.FormatFast(buf) buf.WriteByte(')') } -// formatFast formats the node. -func (node *LocateExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *LocateExpr) FormatFast(buf *TrackedBuffer) { if node.Pos != nil { buf.WriteString("locate(") buf.printExpr(node, node.SubStr, true) @@ -2398,10 +2398,10 @@ func (node *LocateExpr) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (node *CharExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *CharExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("char(") - node.Exprs.formatFast(buf) + node.Exprs.FormatFast(buf) if node.Charset != "" { buf.WriteString(" using ") buf.WriteString(node.Charset) @@ -2409,46 +2409,46 @@ func (node *CharExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node. -func (node *NamedWindow) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *NamedWindow) FormatFast(buf *TrackedBuffer) { buf.WriteString("window ") - node.Windows.formatFast(buf) + node.Windows.FormatFast(buf) } -// formatFast formats the node. -func (node NamedWindows) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node NamedWindows) FormatFast(buf *TrackedBuffer) { var prefix string for _, n := range node { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } -// formatFast formats the node. -func (node *WindowDefinition) formatFast(buf *TrackedBuffer) { - node.Name.formatFast(buf) +// FormatFast formats the node. +func (node *WindowDefinition) FormatFast(buf *TrackedBuffer) { + node.Name.FormatFast(buf) buf.WriteString(" AS (") - node.WindowSpec.formatFast(buf) + node.WindowSpec.FormatFast(buf) buf.WriteByte(')') } -// formatFast formats the node. -func (node WindowDefinitions) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node WindowDefinitions) FormatFast(buf *TrackedBuffer) { var prefix string for _, n := range node { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } -// formatFast formats the node. -func (node *CastExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *CastExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("cast(") buf.printExpr(node, node.Expr, true) buf.WriteString(" as ") - node.Type.formatFast(buf) + node.Type.FormatFast(buf) if node.Array { buf.WriteByte(' ') buf.WriteString(keywordStrings[ARRAY]) @@ -2456,17 +2456,17 @@ func (node *CastExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node. -func (node *ConvertExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *ConvertExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("convert(") buf.printExpr(node, node.Expr, true) buf.WriteString(", ") - node.Type.formatFast(buf) + node.Type.FormatFast(buf) buf.WriteByte(')') } -// formatFast formats the node. -func (node *ConvertUsingExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *ConvertUsingExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("convert(") buf.printExpr(node, node.Expr, true) buf.WriteString(" using ") @@ -2474,15 +2474,15 @@ func (node *ConvertUsingExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node. -func (node *ConvertType) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *ConvertType) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.Type) if node.Length != nil { buf.WriteByte('(') - node.Length.formatFast(buf) + node.Length.FormatFast(buf) if node.Scale != nil { buf.WriteString(", ") - node.Scale.formatFast(buf) + node.Scale.FormatFast(buf) } buf.WriteByte(')') } @@ -2496,8 +2496,8 @@ func (node *ConvertType) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node -func (node *MatchExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *MatchExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("match(") for i, col := range node.Columns { if i != 0 { @@ -2513,15 +2513,15 @@ func (node *MatchExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node. -func (node *CaseExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *CaseExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("case ") if node.Expr != nil { buf.printExpr(node, node.Expr, true) buf.WriteByte(' ') } for _, when := range node.Whens { - when.formatFast(buf) + when.FormatFast(buf) buf.WriteByte(' ') } if node.Else != nil { @@ -2532,8 +2532,8 @@ func (node *CaseExpr) formatFast(buf *TrackedBuffer) { buf.WriteString("end") } -// formatFast formats the node. -func (node *Default) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Default) FormatFast(buf *TrackedBuffer) { buf.WriteString("default") if node.ColName != "" { buf.WriteByte('(') @@ -2542,36 +2542,36 @@ func (node *Default) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (node *When) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *When) FormatFast(buf *TrackedBuffer) { buf.WriteString("when ") - node.Cond.formatFast(buf) + node.Cond.FormatFast(buf) buf.WriteString(" then ") - node.Val.formatFast(buf) + node.Val.FormatFast(buf) } -// formatFast formats the node. -func (node GroupBy) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node GroupBy) FormatFast(buf *TrackedBuffer) { prefix := " group by " for _, n := range node { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } -// formatFast formats the node. -func (node OrderBy) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node OrderBy) FormatFast(buf *TrackedBuffer) { prefix := " order by " for _, n := range node { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } -// formatFast formats the node. -func (node *Order) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Order) FormatFast(buf *TrackedBuffer) { if node, ok := node.Expr.(*NullVal); ok { buf.printExpr(node, node, true) return @@ -2583,105 +2583,105 @@ func (node *Order) formatFast(buf *TrackedBuffer) { } } - node.Expr.formatFast(buf) + node.Expr.FormatFast(buf) buf.WriteByte(' ') buf.WriteString(node.Direction.ToString()) } -// formatFast formats the node. -func (node *Limit) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Limit) FormatFast(buf *TrackedBuffer) { if node == nil { return } buf.WriteString(" limit ") if node.Offset != nil { - node.Offset.formatFast(buf) + node.Offset.FormatFast(buf) buf.WriteString(", ") } - node.Rowcount.formatFast(buf) + node.Rowcount.FormatFast(buf) } -// formatFast formats the node. -func (node Values) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node Values) FormatFast(buf *TrackedBuffer) { prefix := "values " for _, n := range node { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } -// formatFast formats the node. -func (node UpdateExprs) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node UpdateExprs) FormatFast(buf *TrackedBuffer) { var prefix string for _, n := range node { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } -// formatFast formats the node. -func (node *UpdateExpr) formatFast(buf *TrackedBuffer) { - node.Name.formatFast(buf) +// FormatFast formats the node. +func (node *UpdateExpr) FormatFast(buf *TrackedBuffer) { + node.Name.FormatFast(buf) buf.WriteString(" = ") - node.Expr.formatFast(buf) + node.Expr.FormatFast(buf) } -// formatFast formats the node. -func (node SetExprs) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node SetExprs) FormatFast(buf *TrackedBuffer) { var prefix string for _, n := range node { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } -// formatFast formats the node. -func (node *SetExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *SetExpr) FormatFast(buf *TrackedBuffer) { // We don't have to backtick set variable names. switch { case node.Var.Name.EqualString("charset") || node.Var.Name.EqualString("names"): buf.WriteString(node.Var.Name.String()) buf.WriteByte(' ') - node.Expr.formatFast(buf) + node.Expr.FormatFast(buf) default: - node.Var.formatFast(buf) + node.Var.FormatFast(buf) buf.WriteString(" = ") - node.Expr.formatFast(buf) + node.Expr.FormatFast(buf) } } -// formatFast formats the node. -func (node OnDup) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node OnDup) FormatFast(buf *TrackedBuffer) { if node == nil { return } buf.WriteString(" on duplicate key update ") - UpdateExprs(node).formatFast(buf) + UpdateExprs(node).FormatFast(buf) } -// formatFast formats the node. -func (node IdentifierCI) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node IdentifierCI) FormatFast(buf *TrackedBuffer) { if node.IsEmpty() { return } formatID(buf, node.val, NoAt) } -// formatFast formats the node. -func (node IdentifierCS) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node IdentifierCS) FormatFast(buf *TrackedBuffer) { formatID(buf, node.v, NoAt) } -// formatFast formats the node. -func (node *Load) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Load) FormatFast(buf *TrackedBuffer) { buf.WriteString("AST node missing for Load type") } -// formatFast formats the node. -func (node *ShowBasic) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *ShowBasic) FormatFast(buf *TrackedBuffer) { buf.WriteString("show") if node.Full { buf.WriteString(" full") @@ -2689,31 +2689,31 @@ func (node *ShowBasic) formatFast(buf *TrackedBuffer) { buf.WriteString(node.Command.ToString()) if !node.Tbl.IsEmpty() { buf.WriteString(" from ") - node.Tbl.formatFast(buf) + node.Tbl.FormatFast(buf) } if !node.DbName.IsEmpty() { buf.WriteString(" from ") - node.DbName.formatFast(buf) + node.DbName.FormatFast(buf) } - node.Filter.formatFast(buf) + node.Filter.FormatFast(buf) } -// formatFast formats the node. -func (node *ShowCreate) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *ShowCreate) FormatFast(buf *TrackedBuffer) { buf.WriteString("show") buf.WriteString(node.Command.ToString()) buf.WriteByte(' ') - node.Op.formatFast(buf) + node.Op.FormatFast(buf) } -// formatFast formats the node. -func (node *ShowOther) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *ShowOther) FormatFast(buf *TrackedBuffer) { buf.WriteString("show ") buf.WriteString(node.Command) } -// formatFast formats the node. -func (node *SelectInto) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *SelectInto) FormatFast(buf *TrackedBuffer) { if node == nil { return } @@ -2729,14 +2729,14 @@ func (node *SelectInto) formatFast(buf *TrackedBuffer) { buf.WriteString(node.Overwrite) } -// formatFast formats the node. -func (node *CreateDatabase) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *CreateDatabase) FormatFast(buf *TrackedBuffer) { buf.WriteString("create database ") - node.Comments.formatFast(buf) + node.Comments.FormatFast(buf) if node.IfNotExists { buf.WriteString("if not exists ") } - node.DBName.formatFast(buf) + node.DBName.FormatFast(buf) if node.CreateOptions != nil { for _, createOption := range node.CreateOptions { if createOption.IsDefault { @@ -2749,12 +2749,12 @@ func (node *CreateDatabase) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (node *AlterDatabase) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *AlterDatabase) FormatFast(buf *TrackedBuffer) { buf.WriteString("alter database") if !node.DBName.IsEmpty() { buf.WriteByte(' ') - node.DBName.formatFast(buf) + node.DBName.FormatFast(buf) } if node.UpdateDataDirectory { buf.WriteString(" upgrade data directory name") @@ -2771,10 +2771,10 @@ func (node *AlterDatabase) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (node *CreateTable) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *CreateTable) FormatFast(buf *TrackedBuffer) { buf.WriteString("create ") - node.Comments.formatFast(buf) + node.Comments.FormatFast(buf) if node.Temp { buf.WriteString("temporary ") } @@ -2783,22 +2783,22 @@ func (node *CreateTable) formatFast(buf *TrackedBuffer) { if node.IfNotExists { buf.WriteString("if not exists ") } - node.Table.formatFast(buf) + node.Table.FormatFast(buf) if node.OptLike != nil { buf.WriteByte(' ') - node.OptLike.formatFast(buf) + node.OptLike.FormatFast(buf) } if node.TableSpec != nil { buf.WriteByte(' ') - node.TableSpec.formatFast(buf) + node.TableSpec.FormatFast(buf) } } -// formatFast formats the node. -func (node *CreateView) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *CreateView) FormatFast(buf *TrackedBuffer) { buf.WriteString("create ") - node.Comments.formatFast(buf) + node.Comments.FormatFast(buf) if node.IsReplace { buf.WriteString("or replace ") } @@ -2809,7 +2809,7 @@ func (node *CreateView) formatFast(buf *TrackedBuffer) { } if node.Definer != nil { buf.WriteString("definer = ") - node.Definer.formatFast(buf) + node.Definer.FormatFast(buf) buf.WriteByte(' ') } if node.Security != "" { @@ -2818,10 +2818,10 @@ func (node *CreateView) formatFast(buf *TrackedBuffer) { buf.WriteByte(' ') } buf.WriteString("view ") - node.ViewName.formatFast(buf) - node.Columns.formatFast(buf) + node.ViewName.FormatFast(buf) + node.Columns.FormatFast(buf) buf.WriteString(" as ") - node.Select.formatFast(buf) + node.Select.FormatFast(buf) if node.CheckOption != "" { buf.WriteString(" with ") buf.WriteString(node.CheckOption) @@ -2829,29 +2829,29 @@ func (node *CreateView) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the LockTables node. -func (node *LockTables) formatFast(buf *TrackedBuffer) { +// FormatFast formats the LockTables node. +func (node *LockTables) FormatFast(buf *TrackedBuffer) { buf.WriteString("lock tables ") - node.Tables[0].Table.formatFast(buf) + node.Tables[0].Table.FormatFast(buf) buf.WriteByte(' ') buf.WriteString(node.Tables[0].Lock.ToString()) for i := 1; i < len(node.Tables); i++ { buf.WriteString(", ") - node.Tables[i].Table.formatFast(buf) + node.Tables[i].Table.FormatFast(buf) buf.WriteByte(' ') buf.WriteString(node.Tables[i].Lock.ToString()) } } -// formatFast formats the UnlockTables node. -func (node *UnlockTables) formatFast(buf *TrackedBuffer) { +// FormatFast formats the UnlockTables node. +func (node *UnlockTables) FormatFast(buf *TrackedBuffer) { buf.WriteString("unlock tables") } -// formatFast formats the node. -func (node *AlterView) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *AlterView) FormatFast(buf *TrackedBuffer) { buf.WriteString("alter ") - node.Comments.formatFast(buf) + node.Comments.FormatFast(buf) if node.Algorithm != "" { buf.WriteString("algorithm = ") buf.WriteString(node.Algorithm) @@ -2859,7 +2859,7 @@ func (node *AlterView) formatFast(buf *TrackedBuffer) { } if node.Definer != nil { buf.WriteString("definer = ") - node.Definer.formatFast(buf) + node.Definer.FormatFast(buf) buf.WriteByte(' ') } if node.Security != "" { @@ -2868,10 +2868,10 @@ func (node *AlterView) formatFast(buf *TrackedBuffer) { buf.WriteByte(' ') } buf.WriteString("view ") - node.ViewName.formatFast(buf) - node.Columns.formatFast(buf) + node.ViewName.FormatFast(buf) + node.Columns.FormatFast(buf) buf.WriteString(" as ") - node.Select.formatFast(buf) + node.Select.FormatFast(buf) if node.CheckOption != "" { buf.WriteString(" with ") buf.WriteString(node.CheckOption) @@ -2879,7 +2879,7 @@ func (node *AlterView) formatFast(buf *TrackedBuffer) { } } -func (definer *Definer) formatFast(buf *TrackedBuffer) { +func (definer *Definer) FormatFast(buf *TrackedBuffer) { buf.WriteString(definer.Name) if definer.Address != "" { buf.WriteByte('@') @@ -2887,8 +2887,8 @@ func (definer *Definer) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (node *DropTable) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *DropTable) FormatFast(buf *TrackedBuffer) { temp := "" if node.Temp { temp = "temporary " @@ -2898,18 +2898,18 @@ func (node *DropTable) formatFast(buf *TrackedBuffer) { exists = " if exists" } buf.WriteString("drop ") - node.Comments.formatFast(buf) + node.Comments.FormatFast(buf) buf.WriteString(temp) buf.WriteString("table") buf.WriteString(exists) buf.WriteByte(' ') - node.FromTables.formatFast(buf) + node.FromTables.FormatFast(buf) } -// formatFast formats the node. -func (node *DropView) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *DropView) FormatFast(buf *TrackedBuffer) { buf.WriteString("drop ") - node.Comments.formatFast(buf) + node.Comments.FormatFast(buf) exists := "" if node.IfExists { exists = " if exists" @@ -2917,22 +2917,22 @@ func (node *DropView) formatFast(buf *TrackedBuffer) { buf.WriteString("view") buf.WriteString(exists) buf.WriteByte(' ') - node.FromTables.formatFast(buf) + node.FromTables.FormatFast(buf) } -// formatFast formats the AlterTable node. -func (node *AlterTable) formatFast(buf *TrackedBuffer) { +// FormatFast formats the AlterTable node. +func (node *AlterTable) FormatFast(buf *TrackedBuffer) { buf.WriteString("alter ") - node.Comments.formatFast(buf) + node.Comments.FormatFast(buf) buf.WriteString("table ") - node.Table.formatFast(buf) + node.Table.FormatFast(buf) prefix := "" for i, option := range node.AlterOptions { if i != 0 { buf.WriteByte(',') } buf.WriteByte(' ') - option.formatFast(buf) + option.FormatFast(buf) if node.PartitionSpec != nil && node.PartitionSpec.Action != RemoveAction { prefix = "," } @@ -2940,24 +2940,24 @@ func (node *AlterTable) formatFast(buf *TrackedBuffer) { if node.PartitionSpec != nil { buf.WriteString(prefix) buf.WriteByte(' ') - node.PartitionSpec.formatFast(buf) + node.PartitionSpec.FormatFast(buf) } if node.PartitionOption != nil { buf.WriteString(prefix) buf.WriteByte(' ') - node.PartitionOption.formatFast(buf) + node.PartitionOption.FormatFast(buf) } } -// formatFast formats the node. -func (node *AddConstraintDefinition) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *AddConstraintDefinition) FormatFast(buf *TrackedBuffer) { buf.WriteString("add ") - node.ConstraintDefinition.formatFast(buf) + node.ConstraintDefinition.FormatFast(buf) } -func (node *AlterCheck) formatFast(buf *TrackedBuffer) { +func (node *AlterCheck) FormatFast(buf *TrackedBuffer) { buf.WriteString("alter check ") - node.Name.formatFast(buf) + node.Name.FormatFast(buf) if node.Enforced { buf.WriteByte(' ') buf.WriteString(keywordStrings[ENFORCED]) @@ -2969,58 +2969,58 @@ func (node *AlterCheck) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node. -func (node *AddIndexDefinition) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *AddIndexDefinition) FormatFast(buf *TrackedBuffer) { buf.WriteString("add ") - node.IndexDefinition.formatFast(buf) + node.IndexDefinition.FormatFast(buf) } -// formatFast formats the node. -func (node *AddColumns) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *AddColumns) FormatFast(buf *TrackedBuffer) { if len(node.Columns) == 1 { buf.WriteString("add column ") - node.Columns[0].formatFast(buf) + node.Columns[0].FormatFast(buf) if node.First { buf.WriteString(" first") } if node.After != nil { buf.WriteString(" after ") - node.After.formatFast(buf) + node.After.FormatFast(buf) } } else { for i, col := range node.Columns { if i == 0 { buf.WriteString("add column (") - col.formatFast(buf) + col.FormatFast(buf) } else { buf.WriteString(", ") - col.formatFast(buf) + col.FormatFast(buf) } } buf.WriteByte(')') } } -// formatFast formats the node. -func (node AlgorithmValue) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node AlgorithmValue) FormatFast(buf *TrackedBuffer) { buf.WriteString("algorithm = ") buf.WriteString(string(node)) } -// formatFast formats the node -func (node *AlterColumn) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *AlterColumn) FormatFast(buf *TrackedBuffer) { buf.WriteString("alter column ") - node.Column.formatFast(buf) + node.Column.FormatFast(buf) if node.DropDefault { buf.WriteString(" drop default") } else if node.DefaultVal != nil { if node.DefaultLiteral { buf.WriteString(" set default ") - node.DefaultVal.formatFast(buf) + node.DefaultVal.FormatFast(buf) } else { buf.WriteString(" set default (") - node.DefaultVal.formatFast(buf) + node.DefaultVal.FormatFast(buf) buf.WriteByte(')') } } @@ -3033,10 +3033,10 @@ func (node *AlterColumn) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node -func (node *AlterIndex) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *AlterIndex) FormatFast(buf *TrackedBuffer) { buf.WriteString("alter index ") - node.Name.formatFast(buf) + node.Name.FormatFast(buf) if node.Invisible { buf.WriteString(" invisible") } else { @@ -3044,44 +3044,44 @@ func (node *AlterIndex) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node -func (node *ChangeColumn) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *ChangeColumn) FormatFast(buf *TrackedBuffer) { buf.WriteString("change column ") - node.OldColumn.formatFast(buf) + node.OldColumn.FormatFast(buf) buf.WriteByte(' ') - node.NewColDefinition.formatFast(buf) + node.NewColDefinition.FormatFast(buf) if node.First { buf.WriteString(" first") } if node.After != nil { buf.WriteString(" after ") - node.After.formatFast(buf) + node.After.FormatFast(buf) } } -// formatFast formats the node -func (node *ModifyColumn) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *ModifyColumn) FormatFast(buf *TrackedBuffer) { buf.WriteString("modify column ") - node.NewColDefinition.formatFast(buf) + node.NewColDefinition.FormatFast(buf) if node.First { buf.WriteString(" first") } if node.After != nil { buf.WriteString(" after ") - node.After.formatFast(buf) + node.After.FormatFast(buf) } } -// formatFast formats the node -func (node *RenameColumn) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *RenameColumn) FormatFast(buf *TrackedBuffer) { buf.WriteString("rename column ") - node.OldName.formatFast(buf) + node.OldName.FormatFast(buf) buf.WriteString(" to ") - node.NewName.formatFast(buf) + node.NewName.FormatFast(buf) } -// formatFast formats the node -func (node *AlterCharset) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *AlterCharset) FormatFast(buf *TrackedBuffer) { buf.WriteString("convert to character set ") buf.WriteString(node.CharacterSet) if node.Collate != "" { @@ -3090,8 +3090,8 @@ func (node *AlterCharset) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node -func (node *KeyState) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *KeyState) FormatFast(buf *TrackedBuffer) { if node.Enable { buf.WriteString("enable keys") } else { @@ -3100,8 +3100,8 @@ func (node *KeyState) formatFast(buf *TrackedBuffer) { } -// formatFast formats the node -func (node *TablespaceOperation) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *TablespaceOperation) FormatFast(buf *TrackedBuffer) { if node.Import { buf.WriteString("import tablespace") } else { @@ -3109,60 +3109,60 @@ func (node *TablespaceOperation) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node -func (node *DropColumn) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *DropColumn) FormatFast(buf *TrackedBuffer) { buf.WriteString("drop column ") - node.Name.formatFast(buf) + node.Name.FormatFast(buf) } -// formatFast formats the node -func (node *DropKey) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *DropKey) FormatFast(buf *TrackedBuffer) { buf.WriteString("drop ") buf.WriteString(node.Type.ToString()) if !node.Name.IsEmpty() { buf.WriteByte(' ') - node.Name.formatFast(buf) + node.Name.FormatFast(buf) } } -// formatFast formats the node -func (node *Force) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *Force) FormatFast(buf *TrackedBuffer) { buf.WriteString("force") } -// formatFast formats the node -func (node *LockOption) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *LockOption) FormatFast(buf *TrackedBuffer) { buf.WriteString("lock ") buf.WriteString(node.Type.ToString()) } -// formatFast formats the node -func (node *OrderByOption) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *OrderByOption) FormatFast(buf *TrackedBuffer) { buf.WriteString("order by ") prefix := "" for _, n := range node.Cols { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } } -// formatFast formats the node -func (node *RenameTableName) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *RenameTableName) FormatFast(buf *TrackedBuffer) { buf.WriteString("rename ") - node.Table.formatFast(buf) + node.Table.FormatFast(buf) } -// formatFast formats the node -func (node *RenameIndex) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *RenameIndex) FormatFast(buf *TrackedBuffer) { buf.WriteString("rename index ") - node.OldName.formatFast(buf) + node.OldName.FormatFast(buf) buf.WriteString(" to ") - node.NewName.formatFast(buf) + node.NewName.FormatFast(buf) } -// formatFast formats the node -func (node *Validation) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *Validation) FormatFast(buf *TrackedBuffer) { if node.With { buf.WriteString("with validation") } else { @@ -3170,8 +3170,8 @@ func (node *Validation) formatFast(buf *TrackedBuffer) { } } -// formatFast formats the node -func (node TableOptions) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node TableOptions) FormatFast(buf *TrackedBuffer) { for i, option := range node { if i != 0 { buf.WriteByte(' ') @@ -3188,97 +3188,97 @@ func (node TableOptions) formatFast(buf *TrackedBuffer) { } case option.Value != nil: buf.WriteByte(' ') - option.Value.formatFast(buf) + option.Value.FormatFast(buf) default: buf.WriteString(" (") - option.Tables.formatFast(buf) + option.Tables.FormatFast(buf) buf.WriteByte(')') } } } -// formatFast formats the node -func (node *TruncateTable) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *TruncateTable) FormatFast(buf *TrackedBuffer) { buf.WriteString("truncate table ") - node.Table.formatFast(buf) + node.Table.FormatFast(buf) } -// formatFast formats the node. -func (node *RenameTable) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *RenameTable) FormatFast(buf *TrackedBuffer) { buf.WriteString("rename table") prefix := " " for _, pair := range node.TablePairs { buf.WriteString(prefix) - pair.FromTable.formatFast(buf) + pair.FromTable.FormatFast(buf) buf.WriteString(" to ") - pair.ToTable.formatFast(buf) + pair.ToTable.FormatFast(buf) prefix = ", " } } -func (node *JSONTableExpr) formatFast(buf *TrackedBuffer) { +func (node *JSONTableExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("json_table(") - node.Expr.formatFast(buf) + node.Expr.FormatFast(buf) buf.WriteString(", ") - node.Filter.formatFast(buf) + node.Filter.FormatFast(buf) buf.WriteString(" columns(\n") sz := len(node.Columns) for i := 0; i < sz-1; i++ { buf.WriteByte('\t') - node.Columns[i].formatFast(buf) + node.Columns[i].FormatFast(buf) buf.WriteString(",\n") } buf.WriteByte('\t') - node.Columns[sz-1].formatFast(buf) + node.Columns[sz-1].FormatFast(buf) buf.WriteByte('\n') buf.WriteString("\t)\n) as ") - node.Alias.formatFast(buf) + node.Alias.FormatFast(buf) } -func (node *JtColumnDefinition) formatFast(buf *TrackedBuffer) { +func (node *JtColumnDefinition) FormatFast(buf *TrackedBuffer) { if node.JtOrdinal != nil { - node.JtOrdinal.Name.formatFast(buf) + node.JtOrdinal.Name.FormatFast(buf) buf.WriteString(" for ordinality") } else if node.JtNestedPath != nil { buf.WriteString("nested path ") - node.JtNestedPath.Path.formatFast(buf) + node.JtNestedPath.Path.FormatFast(buf) buf.WriteString(" columns(\n") sz := len(node.JtNestedPath.Columns) for i := 0; i < sz-1; i++ { buf.WriteByte('\t') - node.JtNestedPath.Columns[i].formatFast(buf) + node.JtNestedPath.Columns[i].FormatFast(buf) buf.WriteString(",\n") } buf.WriteByte('\t') - node.JtNestedPath.Columns[sz-1].formatFast(buf) + node.JtNestedPath.Columns[sz-1].FormatFast(buf) buf.WriteString("\n)") } else if node.JtPath != nil { - node.JtPath.Name.formatFast(buf) + node.JtPath.Name.FormatFast(buf) buf.WriteByte(' ') - node.JtPath.Type.formatFast(buf) + node.JtPath.Type.FormatFast(buf) buf.WriteByte(' ') if node.JtPath.JtColExists { buf.WriteString("exists ") } buf.WriteString("path ") - node.JtPath.Path.formatFast(buf) + node.JtPath.Path.FormatFast(buf) buf.WriteByte(' ') if node.JtPath.EmptyOnResponse != nil { - node.JtPath.EmptyOnResponse.formatFast(buf) + node.JtPath.EmptyOnResponse.FormatFast(buf) buf.WriteString(" on empty ") } if node.JtPath.ErrorOnResponse != nil { - node.JtPath.ErrorOnResponse.formatFast(buf) + node.JtPath.ErrorOnResponse.FormatFast(buf) buf.WriteString(" on error ") } } } -func (node *JtOnResponse) formatFast(buf *TrackedBuffer) { +func (node *JtOnResponse) FormatFast(buf *TrackedBuffer) { switch node.ResponseType { case ErrorJSONType: buf.WriteString("error") @@ -3286,18 +3286,18 @@ func (node *JtOnResponse) formatFast(buf *TrackedBuffer) { buf.WriteString("null") case DefaultJSONType: buf.WriteString("default ") - node.Expr.formatFast(buf) + node.Expr.FormatFast(buf) } } -// formatFast formats the node. -func (node *Offset) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Offset) FormatFast(buf *TrackedBuffer) { buf.WriteByte(':') buf.WriteString(fmt.Sprintf("%d", node.V)) } -// formatFast formats the node. -func (node *JSONSchemaValidFuncExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *JSONSchemaValidFuncExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("json_schema_valid(") buf.printExpr(node, node.Schema, true) buf.WriteString(", ") @@ -3305,8 +3305,8 @@ func (node *JSONSchemaValidFuncExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node. -func (node *JSONSchemaValidationReportFuncExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *JSONSchemaValidationReportFuncExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("json_schema_validation_report(") buf.printExpr(node, node.Schema, true) buf.WriteString(", ") @@ -3314,8 +3314,8 @@ func (node *JSONSchemaValidationReportFuncExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node. -func (node *JSONArrayExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *JSONArrayExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("json_array(") if len(node.Params) > 0 { var prefix string @@ -3328,8 +3328,8 @@ func (node *JSONArrayExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node. -func (node *JSONObjectExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *JSONObjectExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("json_object(") if len(node.Params) > 0 { for i, p := range node.Params { @@ -3337,28 +3337,28 @@ func (node *JSONObjectExpr) formatFast(buf *TrackedBuffer) { buf.WriteString(", ") } - p.formatFast(buf) + p.FormatFast(buf) } } buf.WriteByte(')') } -// formatFast formats the node. -func (node *JSONObjectParam) formatFast(buf *TrackedBuffer) { - node.Key.formatFast(buf) +// FormatFast formats the node. +func (node *JSONObjectParam) FormatFast(buf *TrackedBuffer) { + node.Key.FormatFast(buf) buf.WriteString(", ") - node.Value.formatFast(buf) + node.Value.FormatFast(buf) } -// formatFast formats the node. -func (node *JSONQuoteExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *JSONQuoteExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("json_quote(") buf.printExpr(node, node.StringArg, true) buf.WriteByte(')') } -// formatFast formats the node -func (node *JSONContainsExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *JSONContainsExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("json_contains(") buf.printExpr(node, node.Target, true) buf.WriteString(", ") @@ -3375,8 +3375,8 @@ func (node *JSONContainsExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *JSONContainsPathExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *JSONContainsPathExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("json_contains_path(") buf.printExpr(node, node.JSONDoc, true) buf.WriteString(", ") @@ -3391,8 +3391,8 @@ func (node *JSONContainsPathExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *JSONExtractExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *JSONExtractExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("json_extract(") buf.printExpr(node, node.JSONDoc, true) buf.WriteString(", ") @@ -3405,8 +3405,8 @@ func (node *JSONExtractExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *JSONKeysExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *JSONKeysExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("json_keys(") buf.printExpr(node, node.JSONDoc, true) if node.Path != nil { @@ -3418,8 +3418,8 @@ func (node *JSONKeysExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *JSONOverlapsExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *JSONOverlapsExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("json_overlaps(") buf.printExpr(node, node.JSONDoc1, true) buf.WriteString(", ") @@ -3427,8 +3427,8 @@ func (node *JSONOverlapsExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *JSONSearchExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *JSONSearchExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("json_search(") buf.printExpr(node, node.JSONDoc, true) buf.WriteString(", ") @@ -3451,8 +3451,8 @@ func (node *JSONSearchExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *JSONValueExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *JSONValueExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("json_value(") buf.printExpr(node, node.JSONDoc, true) buf.WriteString(", ") @@ -3460,34 +3460,34 @@ func (node *JSONValueExpr) formatFast(buf *TrackedBuffer) { if node.ReturningType != nil { buf.WriteString(" returning ") - node.ReturningType.formatFast(buf) + node.ReturningType.FormatFast(buf) } if node.EmptyOnResponse != nil { buf.WriteByte(' ') - node.EmptyOnResponse.formatFast(buf) + node.EmptyOnResponse.FormatFast(buf) buf.WriteString(" on empty") } if node.ErrorOnResponse != nil { buf.WriteByte(' ') - node.ErrorOnResponse.formatFast(buf) + node.ErrorOnResponse.FormatFast(buf) buf.WriteString(" on error") } buf.WriteByte(')') } -// formatFast formats the node -func (node *MemberOfExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *MemberOfExpr) FormatFast(buf *TrackedBuffer) { buf.printExpr(node, node.Value, true) buf.WriteString(" member of (") buf.printExpr(node, node.JSONArr, true) buf.WriteByte(')') } -// formatFast formats the node -func (node *JSONAttributesExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *JSONAttributesExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.Type.ToString()) buf.WriteByte('(') buf.printExpr(node, node.JSONDoc, true) @@ -3498,8 +3498,8 @@ func (node *JSONAttributesExpr) formatFast(buf *TrackedBuffer) { buf.WriteString(")") } -// formatFast formats the node. -func (node *JSONValueModifierExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *JSONValueModifierExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.Type.ToString()) buf.WriteByte('(') buf.printExpr(node, node.JSONDoc, true) @@ -3507,14 +3507,14 @@ func (node *JSONValueModifierExpr) formatFast(buf *TrackedBuffer) { var prefix string for _, n := range node.Params { buf.WriteString(prefix) - n.formatFast(buf) + n.FormatFast(buf) prefix = ", " } buf.WriteString(")") } -// formatFast formats the node. -func (node *JSONValueMergeExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *JSONValueMergeExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.Type.ToString()) buf.WriteByte('(') buf.printExpr(node, node.JSONDoc, true) @@ -3528,8 +3528,8 @@ func (node *JSONValueMergeExpr) formatFast(buf *TrackedBuffer) { buf.WriteString(")") } -// formatFast formats the node. -func (node *JSONRemoveExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *JSONRemoveExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("json_remove(") buf.printExpr(node, node.JSONDoc, true) buf.WriteString(", ") @@ -3542,34 +3542,34 @@ func (node *JSONRemoveExpr) formatFast(buf *TrackedBuffer) { buf.WriteString(")") } -// formatFast formats the node. -func (node *JSONUnquoteExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *JSONUnquoteExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("json_unquote(") buf.printExpr(node, node.JSONValue, true) buf.WriteString(")") } -func (node *Count) formatFast(buf *TrackedBuffer) { +func (node *Count) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.AggrName()) buf.WriteByte('(') if node.Distinct { buf.WriteString(DistinctStr) } - node.Args.formatFast(buf) + node.Args.FormatFast(buf) buf.WriteByte(')') } -func (node *CountStar) formatFast(buf *TrackedBuffer) { +func (node *CountStar) FormatFast(buf *TrackedBuffer) { buf.WriteString("count(*)") } -func (node *AnyValue) formatFast(buf *TrackedBuffer) { +func (node *AnyValue) FormatFast(buf *TrackedBuffer) { buf.WriteString("any_value(") buf.printExpr(node, node.Arg, true) buf.WriteByte(')') } -func (node *Avg) formatFast(buf *TrackedBuffer) { +func (node *Avg) FormatFast(buf *TrackedBuffer) { buf.WriteString("avg(") if node.Distinct { buf.WriteString(DistinctStr) @@ -3578,7 +3578,7 @@ func (node *Avg) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -func (node *Max) formatFast(buf *TrackedBuffer) { +func (node *Max) FormatFast(buf *TrackedBuffer) { buf.WriteString("max(") if node.Distinct { buf.WriteString(DistinctStr) @@ -3587,7 +3587,7 @@ func (node *Max) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -func (node *Min) formatFast(buf *TrackedBuffer) { +func (node *Min) FormatFast(buf *TrackedBuffer) { buf.WriteString("min(") if node.Distinct { buf.WriteString(DistinctStr) @@ -3596,7 +3596,7 @@ func (node *Min) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -func (node *Sum) formatFast(buf *TrackedBuffer) { +func (node *Sum) FormatFast(buf *TrackedBuffer) { buf.WriteString("sum(") if node.Distinct { buf.WriteString(DistinctStr) @@ -3605,68 +3605,68 @@ func (node *Sum) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -func (node *BitAnd) formatFast(buf *TrackedBuffer) { +func (node *BitAnd) FormatFast(buf *TrackedBuffer) { buf.WriteString("bit_and(") buf.printExpr(node, node.Arg, true) buf.WriteByte(')') } -func (node *BitOr) formatFast(buf *TrackedBuffer) { +func (node *BitOr) FormatFast(buf *TrackedBuffer) { buf.WriteString("bit_or(") buf.printExpr(node, node.Arg, true) buf.WriteByte(')') } -func (node *BitXor) formatFast(buf *TrackedBuffer) { +func (node *BitXor) FormatFast(buf *TrackedBuffer) { buf.WriteString("bit_xor(") buf.printExpr(node, node.Arg, true) buf.WriteByte(')') } -func (node *Std) formatFast(buf *TrackedBuffer) { +func (node *Std) FormatFast(buf *TrackedBuffer) { buf.WriteString("std(") buf.printExpr(node, node.Arg, true) buf.WriteByte(')') } -func (node *StdDev) formatFast(buf *TrackedBuffer) { +func (node *StdDev) FormatFast(buf *TrackedBuffer) { buf.WriteString("stddev(") buf.printExpr(node, node.Arg, true) buf.WriteByte(')') } -func (node *StdPop) formatFast(buf *TrackedBuffer) { +func (node *StdPop) FormatFast(buf *TrackedBuffer) { buf.WriteString("stddev_pop(") buf.printExpr(node, node.Arg, true) buf.WriteByte(')') } -func (node *StdSamp) formatFast(buf *TrackedBuffer) { +func (node *StdSamp) FormatFast(buf *TrackedBuffer) { buf.WriteString("stddev_samp(") buf.printExpr(node, node.Arg, true) buf.WriteByte(')') } -func (node *VarPop) formatFast(buf *TrackedBuffer) { +func (node *VarPop) FormatFast(buf *TrackedBuffer) { buf.WriteString("var_pop(") buf.printExpr(node, node.Arg, true) buf.WriteByte(')') } -func (node *VarSamp) formatFast(buf *TrackedBuffer) { +func (node *VarSamp) FormatFast(buf *TrackedBuffer) { buf.WriteString("var_samp(") buf.printExpr(node, node.Arg, true) buf.WriteByte(')') } -func (node *Variance) formatFast(buf *TrackedBuffer) { +func (node *Variance) FormatFast(buf *TrackedBuffer) { buf.WriteString("variance(") buf.printExpr(node, node.Arg, true) buf.WriteByte(')') } -// formatFast formats the node. -func (node *LockingFunc) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *LockingFunc) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.Type.ToString() + "(") if node.Type != ReleaseAllLocks { buf.printExpr(node, node.Name, true) @@ -3678,8 +3678,8 @@ func (node *LockingFunc) formatFast(buf *TrackedBuffer) { buf.WriteString(")") } -// formatFast formats the node. -func (node *Variable) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *Variable) FormatFast(buf *TrackedBuffer) { switch node.Scope { case VariableScope: buf.WriteString("@") @@ -3700,11 +3700,11 @@ func (node *Variable) formatFast(buf *TrackedBuffer) { case NextTxScope: buf.WriteString("@@") } - node.Name.formatFast(buf) + node.Name.FormatFast(buf) } -// formatFast formats the node. -func (node *PointExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *PointExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("point(") buf.printExpr(node, node.XCordinate, true) buf.WriteString(", ") @@ -3712,22 +3712,22 @@ func (node *PointExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node. -func (node *LineStringExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *LineStringExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("linestring(") - node.PointParams.formatFast(buf) + node.PointParams.FormatFast(buf) buf.WriteByte(')') } -// formatFast formats the node. -func (node *PolygonExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *PolygonExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("polygon(") - node.LinestringParams.formatFast(buf) + node.LinestringParams.FormatFast(buf) buf.WriteByte(')') } -// formatFast formats the node. -func (node *PurgeBinaryLogs) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *PurgeBinaryLogs) FormatFast(buf *TrackedBuffer) { buf.WriteString("purge binary logs") if node.To != "" { buf.WriteString(" to '") @@ -3740,28 +3740,28 @@ func (node *PurgeBinaryLogs) formatFast(buf *TrackedBuffer) { } } -func (node *MultiPolygonExpr) formatFast(buf *TrackedBuffer) { +func (node *MultiPolygonExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("multipolygon(") - node.PolygonParams.formatFast(buf) + node.PolygonParams.FormatFast(buf) buf.WriteByte(')') } -// formatFast formats the node. -func (node *MultiPointExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *MultiPointExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("multipoint(") - node.PointParams.formatFast(buf) + node.PointParams.FormatFast(buf) buf.WriteByte(')') } -// formatFast formats the node. -func (node *MultiLinestringExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node. +func (node *MultiLinestringExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("multilinestring(") - node.LinestringParams.formatFast(buf) + node.LinestringParams.FormatFast(buf) buf.WriteByte(')') } -// formatFast formats the node -func (node *GeomFromTextExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *GeomFromTextExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.Type.ToString()) buf.WriteByte('(') buf.printExpr(node, node.WktText, true) @@ -3776,8 +3776,8 @@ func (node *GeomFromTextExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *GeomFromWKBExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *GeomFromWKBExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.Type.ToString()) buf.WriteByte('(') buf.printExpr(node, node.WkbBlob, true) @@ -3792,8 +3792,8 @@ func (node *GeomFromWKBExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *GeomFormatExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *GeomFormatExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.FormatType.ToString()) buf.WriteByte('(') buf.printExpr(node, node.Geom, true) @@ -3804,16 +3804,16 @@ func (node *GeomFormatExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *GeomPropertyFuncExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *GeomPropertyFuncExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.Property.ToString()) buf.WriteByte('(') buf.printExpr(node, node.Geom, true) buf.WriteByte(')') } -// formatFast formats the node -func (node *PointPropertyFuncExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *PointPropertyFuncExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.Property.ToString()) buf.WriteByte('(') buf.printExpr(node, node.Point, true) @@ -3824,8 +3824,8 @@ func (node *PointPropertyFuncExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *LinestrPropertyFuncExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *LinestrPropertyFuncExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.Property.ToString()) buf.WriteByte('(') buf.printExpr(node, node.Linestring, true) @@ -3836,8 +3836,8 @@ func (node *LinestrPropertyFuncExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *PolygonPropertyFuncExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *PolygonPropertyFuncExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.Property.ToString()) buf.WriteByte('(') buf.printExpr(node, node.Polygon, true) @@ -3848,8 +3848,8 @@ func (node *PolygonPropertyFuncExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *GeomCollPropertyFuncExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *GeomCollPropertyFuncExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.Property.ToString()) buf.WriteByte('(') buf.printExpr(node, node.GeomColl, true) @@ -3860,8 +3860,8 @@ func (node *GeomCollPropertyFuncExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *GeomFromGeoHashExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *GeomFromGeoHashExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString(node.GeomType.ToString()) buf.WriteByte('(') buf.printExpr(node, node.GeoHash, true) @@ -3872,8 +3872,8 @@ func (node *GeomFromGeoHashExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *GeoHashFromLatLongExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *GeoHashFromLatLongExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("st_geohash(") buf.printExpr(node, node.Longitude, true) buf.WriteString(", ") @@ -3883,8 +3883,8 @@ func (node *GeoHashFromLatLongExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *GeoHashFromPointExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *GeoHashFromPointExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("st_geohash(") buf.printExpr(node, node.Point, true) buf.WriteString(", ") @@ -3892,8 +3892,8 @@ func (node *GeoHashFromPointExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *GeoJSONFromGeomExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *GeoJSONFromGeomExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("st_asgeojson(") buf.printExpr(node, node.Geom, true) if node.MaxDecimalDigits != nil { @@ -3907,8 +3907,8 @@ func (node *GeoJSONFromGeomExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the node -func (node *GeomFromGeoJSONExpr) formatFast(buf *TrackedBuffer) { +// FormatFast formats the node +func (node *GeomFromGeoJSONExpr) FormatFast(buf *TrackedBuffer) { buf.WriteString("st_geomfromgeojson(") buf.printExpr(node, node.GeoJSON, true) if node.HigherDimHandlerOpt != nil { @@ -3922,8 +3922,8 @@ func (node *GeomFromGeoJSONExpr) formatFast(buf *TrackedBuffer) { buf.WriteByte(')') } -// formatFast formats the kill statement -func (node *Kill) formatFast(buf *TrackedBuffer) { +// FormatFast formats the kill statement +func (node *Kill) FormatFast(buf *TrackedBuffer) { buf.WriteString("kill ") buf.WriteString(node.Type.ToString()) buf.WriteByte(' ') diff --git a/go/vt/sqlparser/ast_funcs.go b/go/vt/sqlparser/ast_funcs.go index fe36386462b..c9f778df0b6 100644 --- a/go/vt/sqlparser/ast_funcs.go +++ b/go/vt/sqlparser/ast_funcs.go @@ -63,7 +63,7 @@ func Append(buf *strings.Builder, node SQLNode) { Builder: buf, fast: true, } - node.formatFast(tbuf) + node.FormatFast(tbuf) } // IndexColumn describes a column or expression in an index definition with optional length (for column) diff --git a/go/vt/sqlparser/tracked_buffer.go b/go/vt/sqlparser/tracked_buffer.go index 59aa9d8b13f..a7fa8d7e1fd 100644 --- a/go/vt/sqlparser/tracked_buffer.go +++ b/go/vt/sqlparser/tracked_buffer.go @@ -126,13 +126,13 @@ func (buf *TrackedBuffer) Myprintf(format string, values ...any) { func (buf *TrackedBuffer) printExpr(currentExpr Expr, expr Expr, left bool) { if precedenceFor(currentExpr) == Syntactic { - expr.formatFast(buf) + expr.FormatFast(buf) } else { needParens := needParens(currentExpr, expr, left) if needParens { buf.WriteByte('(') } - expr.formatFast(buf) + expr.FormatFast(buf) if needParens { buf.WriteByte(')') } @@ -231,7 +231,7 @@ func getExpressionForParensEval(checkParens bool, value any) Expr { func (buf *TrackedBuffer) formatter(node SQLNode) { switch { case buf.fast: - node.formatFast(buf) + node.FormatFast(buf) case buf.nodeFormatter != nil: buf.nodeFormatter(buf, node) default: @@ -317,7 +317,7 @@ func String(node SQLNode) string { } buf := NewTrackedBuffer(nil) - node.formatFast(buf) + node.FormatFast(buf) return buf.String() }