@@ -47,11 +47,11 @@ type Table struct {
4747
4848// Index holds the basic index information
4949type Index struct {
50- Name string
51- Fields []string
52- Unique bool
53- Visible bool
54- Expression string // MySQL 8.0.16+
50+ Name string
51+ Fields []string
52+ Unique bool
53+ Visible bool
54+ Expression string // MySQL 8.0.16+
5555}
5656
5757// IndexField holds raw index information as defined in INFORMATION_SCHEMA table
@@ -68,7 +68,7 @@ type IndexField struct {
6868 Comment string
6969 IndexComment string
7070 NonUnique bool
71- Visible string // MySQL 8.0+
71+ Visible string // MySQL 8.0+
7272 Expression sql.NullString // MySQL 8.0.16+
7373}
7474
@@ -213,35 +213,35 @@ func (t *Table) parse() error {
213213}
214214
215215func makeScanRecipients (f * Field , allowNull * string , cols []string ) []interface {} {
216- fields := []interface {}{
217- & f .TableCatalog ,
218- & f .TableSchema ,
219- & f .TableName ,
220- & f .ColumnName ,
221- & f .OrdinalPosition ,
222- & f .ColumnDefault ,
223- & allowNull ,
224- & f .DataType ,
225- & f .CharacterMaximumLength ,
226- & f .CharacterOctetLength ,
227- & f .NumericPrecision ,
228- & f .NumericScale ,
229- }
230-
231- if len (cols ) > 19 { // MySQL 5.5 does not have "DATETIME_PRECISION" field
232- fields = append (fields , & f .DatetimePrecision )
233- }
234-
235- fields = append (fields , & f .CharacterSetName , & f .CollationName , & f .ColumnType , & f .ColumnKey , & f .Extra , & f .Privileges , & f .ColumnComment )
236-
237- if len (cols ) > 20 && cols [20 ] == "GENERATION_EXPRESSION" { // MySQL 5.7+ "GENERATION_EXPRESSION" field
238- fields = append (fields , & f .GenerationExpression )
239- }
240- if len (cols ) > 21 && cols [21 ] == "SRS_ID" { // MySQL 8.0+ "SRS ID" field
241- fields = append (fields , & f .SrsID )
242- }
243-
244- return fields
216+ fields := []interface {}{
217+ & f .TableCatalog ,
218+ & f .TableSchema ,
219+ & f .TableName ,
220+ & f .ColumnName ,
221+ & f .OrdinalPosition ,
222+ & f .ColumnDefault ,
223+ & allowNull ,
224+ & f .DataType ,
225+ & f .CharacterMaximumLength ,
226+ & f .CharacterOctetLength ,
227+ & f .NumericPrecision ,
228+ & f .NumericScale ,
229+ }
230+
231+ if len (cols ) > 19 { // MySQL 5.5 does not have "DATETIME_PRECISION" field
232+ fields = append (fields , & f .DatetimePrecision )
233+ }
234+
235+ fields = append (fields , & f .CharacterSetName , & f .CollationName , & f .ColumnType , & f .ColumnKey , & f .Extra , & f .Privileges , & f .ColumnComment )
236+
237+ if len (cols ) > 20 && cols [20 ] == "GENERATION_EXPRESSION" { // MySQL 5.7+ "GENERATION_EXPRESSION" field
238+ fields = append (fields , & f .GenerationExpression )
239+ }
240+ if len (cols ) > 21 && cols [21 ] == "SRS_ID" { // MySQL 8.0+ "SRS ID" field
241+ fields = append (fields , & f .SrsID )
242+ }
243+
244+ return fields
245245}
246246
247247// FieldNames returns an string array with the table's field names
@@ -264,7 +264,7 @@ func getIndexes(db *sql.DB, schema, tableName string) (map[string]Index, error)
264264
265265 for rows .Next () {
266266 var i IndexField
267- var table , string
267+ var table , visible string
268268 fields := []interface {}{& table , & i .NonUnique , & i .KeyName , & i .SeqInIndex ,
269269 & i .ColumnName , & i .Collation , & i .Cardinality , & i .SubPart ,
270270 & i .Packed , & i .Null , & i .IndexType , & i .Comment , & i .IndexComment ,
0 commit comments