In Go I'm trying to write a tool to deal with the structure of MySQL tables, so I have to use a lot of queries like this one
show keys from`table`where`Key_name`='Primary'
In MySQL, I can't wrap this command with a select command and select the columns I want, so when I only want one column (in this case Column_name
), how I do deal with the columns that I don't want? Because this query returns all of these other columns as well; Table, Non_unique, Key_name, Seq_in_index, Column_name, Collation, Cardinality, Sub_part, Packed, Null, Index_type, Comment, Index_comment
.
In my Go code, I have lines that look like this
err = keysData.Scan(columnName)
It would be cool if I could do something like this though
err = keysData.Scan(_, _, _, _, columnName)
But that doesn't really work, getting cannot use _ as value
Do I have to declare throw away values for each one of these unneeded columns?