func (optList DatabaseOptionListOpt) Format(buf *TrackedBuffer) {
	for _, dbOpt := range optList.DBOptList {
		if dbOpt.ReadOnlyValue != "" {
			buf.Myprintf(" read only = %s", dbOpt.ReadOnlyValue)
		} else {
			buf.Myprintf(" %s %v", dbOpt.OptType, dbOpt.Value)
		}
	}
}
Format formats the node
package sqlparser
import (
	"strings"
	"github.com/xelabs/go-mysqlstack/sqlparser/depends/sqltypes"
)
type SQLNode interface {
	Format(buf *TrackedBuffer)
}
type (
	Statement interface {
		iStatement()
		SQLNode
	}
	SelectStatement interface {
		iSelectStatement()
		iStatement()
		iInsertRows()
		AddOrder(*Order)
		SetLimit(*Limit)
		SQLNode
	}
	Select struct {
		Cache       string
		Comments    Comments
		Distinct    string
		Hints       string
		SelectExprs SelectExprs
		From        TableExprs
		Where       *Where
		GroupBy     GroupBy
		Having      *Where
		OrderBy     OrderBy
		Limit       *Limit
		Lock        string
		ForBackup   string
	}
	Union struct {
		Type        string
		Left, Right SelectStatement
		OrderBy     OrderBy
		Limit       *Limit
		Lock        string
	}
	ParenSelect struct {
		Select SelectStatement
	}
	Insert struct {
		Action     string
		Comments   Comments
		LockOption string
		Ignore     string
		Table      TableName
		Partitions Partitions
		Columns    Columns
		Rows       InsertRows
		OnDup      OnDup
	}
	Update struct {
		Comments Comments
		Table    TableName
		Exprs    UpdateExprs
		Where    *Where
		OrderBy  OrderBy
		Limit    *Limit
	}
	DeleteOptionList []DeleteOptionEnum
	Delete struct {
		Comments         Comments
		DeleteOptionList DeleteOptionList
		IsSingleTable bool
		TableRefs     TableExprs
		Partitions    Partitions
		IsTableBeforeFrom bool
		TableList         TableNames
		Where             *Where
		OrderBy           OrderBy
		Limit             *Limit
	}
	Do struct {
		Exprs Exprs
	}
	Set struct {
		Comments Comments
		Exprs    SetExprs
	}
	DDL struct {
		Action          string
		Engine          string
		Charset         string
		IndexName       string
		IfExists        bool
		IfNotExists     bool
		Table           TableName
		NewName         TableName
		Database        TableIdent
		DatabaseOptions DatabaseOptionListOpt
		TableSpec       *TableSpec
		PartitionOption PartitionOption
		IndexType string
		IndexOpts *IndexOptions
		indexLockAndAlgorithm *IndexLockAndAlgorithm
		Tables TableNames
		DropColumnName  string
		ModifyColumnDef *ColumnDefinition
	}
	Show struct {
		Type     string
		Full     string
		Scope    string
		Table    TableName
		Database TableIdent
		From     string
		Limit    *Limit
		Filter   *ShowFilter
	}
	Checksum struct {
		Tables         TableNames
		ChecksumOption ChecksumOptionEnum
	}
	Optimize struct {
		OptimizeOption OptimizeOptionEnum
		Tables         TableNames
	}
	Check struct {
		Tables       TableNames
		CheckOptions CheckOptionList
	}
	Use struct {
		DBName TableIdent
	}
	OtherRead struct{}
	OtherAdmin struct{}
	Radon struct {
		Action  string
		Row     ValTuple
		Table   TableName
		NewName TableName
	}
	Explain struct {
		Type      ExplainType
		Analyze   bool
		Statement Statement
	}
	Help struct {
		HelpInfo *SQLVal
	}
	Kill struct {
		QueryID *NumVal
	}
	Transaction struct {
		Action string
	}
	Xa struct{}
)
func (*ParenSelect) iStatement() {}
func (*Union) iStatement()       {}
func (*Select) iStatement()      {}
func (*Insert) iStatement()      {}
func (*Update) iStatement()      {}
func (*Delete) iStatement()      {}
func (*Set) iStatement()         {}
func (*DDL) iStatement()         {}
func (*Show) iStatement()        {}
func (*Use) iStatement()         {}
func (*OtherRead) iStatement()   {}
func (*OtherAdmin) iStatement()  {}
func (*Radon) iStatement()       {}
func (*Explain) iStatement()     {}
func (*Help) iStatement()        {}
func (*Kill) iStatement()        {}
func (*Transaction) iStatement() {}
func (*Xa) iStatement()          {}
func (*Do) iStatement()          {}
func (*Select) iSelectStatement()      {}
func (*Union) iSelectStatement()       {}
func (*ParenSelect) iSelectStatement() {}
func (*Check) iStatement()    {}
func (*Checksum) iStatement() {}
func (*Optimize) iStatement() {}
type (
	InsertRows interface {
		iInsertRows()
		SQLNode
	}
	Values []ValTuple
)
func (*Select) iInsertRows()      {}
func (*Union) iInsertRows()       {}
func (Values) iInsertRows()       {}
func (*ParenSelect) iInsertRows() {}
type DatabaseOptionListOpt struct {
	DBOptList []*DatabaseOption
}
type TableOptions struct {
	Comment          string
	Engine           string
	Charset          string
	AvgRowLength     string
	Checksum         string
	Collate          string
	Compression      string
	Connection       string
	DataDirectory    string
	IndexDirectory   string
	DelayKeyWrite    string
	Encryption       string
	InsertMethod     string
	KeyBlockSize     string
	MaxRows          string
	MinRows          string
	PackKeys         string
	Password         string
	RowFormat        string
	StatsAutoRecalc  string
	StatsPersistent  string
	StatsSamplePages string
	TableSpace       string
}
type IndexOptions struct {
	Columns   []*IndexColumn
	Using     string
	Comment   string
	BlockSize *SQLVal
	Parser    string
}
type IndexDefinition struct {
	Type string
	Name    ColIdent
	Opts    *IndexOptions
	Primary bool
	Unique  bool
}
type IndexLockAndAlgorithm struct {
	LockOption      LockOptionType
	AlgorithmOption AlgorithmOptionType
}
type TableSpec struct {
	Columns []*ColumnDefinition
	Indexes []*IndexDefinition
	Options TableOptions
}
type ColumnDefinition struct {
	Name ColIdent
	Type ColumnType
}
type ColumnType struct {
	Type string
	NotNull       BoolVal
	Autoincrement BoolVal
	Default       *SQLVal
	OnUpdate      string
	Comment       *SQLVal
	Collate       *SQLVal
	ColumnFormat  string
	Storage       string
	Length   *SQLVal
	Unsigned BoolVal
	Zerofill BoolVal
	Scale    *SQLVal
	Charset string
	EnumValues []string
	PrimaryKeyOpt ColumnPrimaryKeyOption
	UniqueKeyOpt  ColumnUniqueKeyOption
}
type ShowFilter struct {
	Like   string
	Filter Expr
}
type Comments [][]byte
type SelectExprs []SelectExpr
type (
	SelectExpr interface {
		iSelectExpr()
		SQLNode
		clone() SelectExpr
	}
	StarExpr struct {
		TableName TableName
	}
	AliasedExpr struct {
		Expr Expr
		As   ColIdent
	}
	Nextval struct {
		Expr Expr
	}
)
func (*StarExpr) iSelectExpr()    {}
func (*AliasedExpr) iSelectExpr() {}
func (Nextval) iSelectExpr()      {}
type Columns []ColIdent
type Partitions Columns
type TableExprs []TableExpr
type (
	TableExpr interface {
		iTableExpr()
		SQLNode
	}
	AliasedTableExpr struct {
		Expr  SimpleTableExpr
		As    TableIdent
		Hints *IndexHints
	}
	ParenTableExpr struct {
		Exprs TableExprs
	}
	JoinTableExpr struct {
		LeftExpr  TableExpr
		Join      string
		RightExpr TableExpr
		On        Expr
	}
)
func (*AliasedTableExpr) iTableExpr() {}
func (*ParenTableExpr) iTableExpr()   {}
func (*JoinTableExpr) iTableExpr()    {}
type (
	SimpleTableExpr interface {
		iSimpleTableExpr()
		SQLNode
	}
	TableName struct {
		Name, Qualifier TableIdent
	}
	Subquery struct {
		Select SelectStatement
	}
)
func (TableName) iSimpleTableExpr() {}
func (*Subquery) iSimpleTableExpr() {}
type TableNames []TableName
type IndexHints struct {
	Type    string
	Indexes []ColIdent
}
type Where struct {
	Type WhereTypeEnum
	Expr Expr
}
type Exprs []Expr
type (
	Expr interface {
		iExpr()
		SQLNode
		clone() Expr
	}
	AndExpr struct {
		Left, Right Expr
	}
	OrExpr struct {
		Left, Right Expr
	}
	NotExpr struct {
		Expr Expr
	}
	ParenExpr struct {
		Expr Expr
	}
	ComparisonExpr struct {
		Operator    string
		Left, Right Expr
		Escape      Expr
	}
	RangeCond struct {
		Operator string
		Left     Expr
		From, To Expr
	}
	IsExpr struct {
		Operator string
		Expr     Expr
	}
	ExistsExpr struct {
		Subquery *Subquery
	}
	SQLVal struct {
		Type ValType
		Val  []byte
	}
	NullVal struct{}
	BoolVal bool
	ColName struct {
		Metadata  interface{}
		Name      ColIdent
		Qualifier TableName
	}
	ColTuple interface {
		iColTuple()
		Expr
	}
	ValTuple Exprs
	ListArg []byte
	BinaryExpr struct {
		Operator    string
		Left, Right Expr
	}
	UnaryExpr struct {
		Operator string
		Expr     Expr
	}
	IntervalExpr struct {
		Expr Expr
		Unit string
	}
	CollateExpr struct {
		Expr    Expr
		Charset string
	}
	FuncExpr struct {
		Qualifier TableIdent
		Name      ColIdent
		Distinct  bool
		Exprs     SelectExprs
	}
	GroupConcatExpr struct {
		Distinct  string
		Exprs     SelectExprs
		OrderBy   OrderBy
		Separator string
	}
	ValuesFuncExpr struct {
		Name     ColIdent
		Resolved Expr
	}
	ConvertExpr struct {
		Expr Expr
		Type *ConvertType
	}
	ConvertUsingExpr struct {
		Expr Expr
		Type string
	}
	MatchExpr struct {
		Columns SelectExprs
		Expr    Expr
		Option  string
	}
	CaseExpr struct {
		Expr  Expr
		Whens []*When
		Else  Expr
	}
	Default struct {
		ColName string
	}
)
func (*AndExpr) iExpr()          {}
func (*OrExpr) iExpr()           {}
func (*NotExpr) iExpr()          {}
func (*ParenExpr) iExpr()        {}
func (*ComparisonExpr) iExpr()   {}
func (*RangeCond) iExpr()        {}
func (*IsExpr) iExpr()           {}
func (*ExistsExpr) iExpr()       {}
func (*SQLVal) 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 (*IntervalExpr) iExpr()     {}
func (*CollateExpr) iExpr()      {}
func (*FuncExpr) iExpr()         {}
func (*GroupConcatExpr) iExpr()  {}
func (*CaseExpr) iExpr()         {}
func (*ValuesFuncExpr) iExpr()   {}
func (*ConvertExpr) iExpr()      {}
func (*ConvertUsingExpr) iExpr() {}
func (*MatchExpr) iExpr()        {}
func (*Default) iExpr()          {}
func (ValTuple) iColTuple()  {}
func (*Subquery) iColTuple() {}
func (ListArg) iColTuple()   {}
type ConvertType struct {
	Type     string
	Length   *SQLVal
	Scale    *SQLVal
	Operator string
	Charset  string
}
type When struct {
	Cond Expr
	Val  Expr
}
type GroupBy Exprs
type OrderBy []*Order
type Order struct {
	Expr      Expr
	Direction string
}
type Limit struct {
	Offset, Rowcount Expr
}
type UpdateExprs []*UpdateExpr
type UpdateExpr struct {
	Name *ColName
	Expr Expr
}
type OnDup UpdateExprs
type SetExprs []*SetExpr
type SetExpr struct {
	Scope string
	Type  ColIdent
	Val   SetVal
}
type (
	SetVal interface {
		SQLNode
		iSetVal()
	}
	OptVal struct {
		Value Expr
	}
	TxnVal struct {
		Level string
		Mode  string
	}
)
func (*OptVal) iSetVal() {}
func (*TxnVal) iSetVal() {}
type ColIdent struct {
	_            [0]struct{ _ []byte }
	val, lowered string
}
type TableIdent struct {
	v string
}
func (node *Select) Format(buf *TrackedBuffer) {
	buf.Myprintf("select %v%s%s%s%v from %v%v%v%v%v%v%s",
		node.Comments, node.Cache, node.Distinct, node.Hints, node.SelectExprs,
		node.From, node.Where,
		node.GroupBy, node.Having, node.OrderBy,
		node.Limit, node.Lock)
}
func (node *Select) AddOrder(order *Order) {
	node.OrderBy = append(node.OrderBy, order)
}
func (node *Select) SetLimit(limit *Limit) {
	node.Limit = limit
}
func (node *ParenSelect) Format(buf *TrackedBuffer) {
	buf.Myprintf("(%v)", node.Select)
}
func (node *ParenSelect) AddOrder(order *Order) {
	panic("unreachable")
}
func (node *ParenSelect) SetLimit(limit *Limit) {
	panic("unreachable")
}
func (node *Union) Format(buf *TrackedBuffer) {
	buf.Myprintf("%v %s %v%v%v%s", node.Left, node.Type, node.Right,
		node.OrderBy, node.Limit, node.Lock)
}
func (node *Union) AddOrder(order *Order) {
	node.OrderBy = append(node.OrderBy, order)
}
func (node *Union) SetLimit(limit *Limit) {
	node.Limit = limit
}
func (node *Insert) Format(buf *TrackedBuffer) {
	buf.Myprintf("%s %v", node.Action, node.Comments)
	if node.LockOption != "" {
		buf.Myprintf("%s ", node.LockOption)
	}
	buf.Myprintf("%sinto %v%v%v %v%v",
		node.Ignore, node.Table, node.Partitions, node.Columns, node.Rows, node.OnDup)
}
func (node *Update) Format(buf *TrackedBuffer) {
	buf.Myprintf("update %v%v set %v%v%v%v",
		node.Comments, node.Table,
		node.Exprs, node.Where, node.OrderBy, node.Limit)
}
func (node *Delete) Format(buf *TrackedBuffer) {
	if node.IsSingleTable {
		buf.Myprintf("delete %v%vfrom %v%v%v%v%v", node.Comments, &(node.DeleteOptionList), node.TableRefs, node.Partitions, node.Where, node.OrderBy, node.Limit)
	} else {
		buf.Myprintf("delete %v%v%v from %v%v%v%v", node.Comments, &(node.DeleteOptionList), node.TableList, node.TableRefs, node.Where, node.OrderBy, node.Limit)
	}
}
func (node *Set) Format(buf *TrackedBuffer) {
	buf.Myprintf("set %v%v", node.Comments, node.Exprs)
}
func (node *DDL) Format(buf *TrackedBuffer) {
	switch node.Action {
	case CreateDBStr:
		ifnotexists := ""
		if node.IfNotExists {
			ifnotexists = " if not exists"
		}
		buf.Myprintf("%s%s %s", node.Action, ifnotexists, node.Database.String())
		node.DatabaseOptions.Format(buf)
	case DropDBStr:
		exists := ""
		if node.IfExists {
			exists = " if exists"
		}
		buf.Myprintf("%s%s %s", node.Action, exists, node.Database.String())
	case CreateTableStr:
		ifnotexists := ""
		if node.IfNotExists {
			ifnotexists = " if not exists"
		}
		if node.TableSpec == nil {
			buf.Myprintf("%s%s %v", node.Action, ifnotexists, node.NewName)
		} else {
			buf.Myprintf("%s%s %v %v", node.Action, ifnotexists, node.NewName, node.TableSpec)
		}
	case CreateIndexStr:
		buf.Myprintf("create %s%s on %v%v%v", node.IndexType, node.IndexName, node.NewName, node.IndexOpts, node.indexLockAndAlgorithm)
	case DropTableStr:
		exists := ""
		if node.IfExists {
			exists = " if exists"
		}
		buf.Myprintf("%s%s %v", node.Action, exists, node.Tables)
	case DropTempTableStr:
		exists := ""
		if node.IfExists {
			exists = " if exists"
		}
		buf.Myprintf("%s%s %v", node.Action, exists, node.Tables)
	case DropIndexStr:
		buf.Myprintf("%s %s on %v%v", node.Action, node.IndexName, node.Table, node.indexLockAndAlgorithm)
	case RenameStr:
		buf.Myprintf("%s %v to %v", node.Action, node.Table, node.NewName)
	case AlterStr:
		buf.Myprintf("%s table %v", node.Action, node.NewName)
	case AlterEngineStr:
		buf.Myprintf("%s %v engine = %s", node.Action, node.NewName, node.Engine)
	case AlterCharsetStr:
		buf.Myprintf("alter table %v convert to character set %s", node.NewName, node.Charset)
	case AlterAddColumnStr:
		buf.Myprintf("alter table %v add column %v", node.NewName, node.TableSpec)
	case AlterDropColumnStr:
		buf.Myprintf("alter table %v drop column `%s`", node.NewName, node.DropColumnName)
	case AlterModifyColumnStr:
		buf.Myprintf("alter table %v modify column %v", node.NewName, node.ModifyColumnDef)
	case AlterDatabase:
		buf.Myprintf("%s %s%v", node.Action, node.Database.String(), node.DatabaseOptions)
	case TruncateTableStr:
		buf.Myprintf("%s %v", node.Action, node.NewName)
	}
}