0

I found this code in the pingcap/parser:

var (
    _ DDLNode = &AlterTableStmt{}
    _ DDLNode = &CreateDatabaseStmt{}
    _ DDLNode = &CreateIndexStmt{}
    _ DDLNode = &CreateTableStmt{}
    _ DDLNode = &CreateViewStmt{}
    _ DDLNode = &DropDatabaseStmt{}
    _ DDLNode = &DropIndexStmt{}
    _ DDLNode = &DropTableStmt{}
    _ DDLNode = &RenameTableStmt{}
    _ DDLNode = &TruncateTableStmt{}

    _ Node = &AlterTableSpec{}
    _ Node = &ColumnDef{}
    _ Node = &ColumnOption{}
    _ Node = &ColumnPosition{}
    _ Node = &Constraint{}
    _ Node = &IndexColName{}
    _ Node = &ReferenceDef{}
)

I can see there are many variables that have the same name DDLNode and Node. I know the underscore _ is the blank identifier in Golang, but why using them there.

Any idea what is the purpose of this work?

Thanks for your help.

anhnq
  • 296
  • 4
  • 15

0 Answers0