title: Go SQL driver get interface{} column values
body: <p>I am trying to use go sql driver to read from database tables and I am converting the values to <code>[]map[string]interface{}</code>. The column name is the key of the map and the values are of <code>interface{}</code>. I am adding all the columns into an array. I am using the code sample for "RawBytes" at <a href="https://github.com/go-sql-driver/mysql/wiki/Examples" rel="nofollow">https://github.com/go-sql-driver/mysql/wiki/Examples</a> as an example to start with.</p>
  
  <p>However, in the example -all the column values are converted to <code>string</code> as follows,</p>
  
  <pre><code>// Fetch rows
  for rows.Next() {
      // get RawBytes from data
      err = rows.Scan(scanArgs...)
      if err != nil {
          panic(err.Error()) // proper error handling instead of panic in your app
      }
  
      // Now do something with the data.
      // Here we just print each column as a string.
      var value string
      for i, col := range values {
          // Here we can check if the value is nil (NULL value)
          if col == nil {
              value = "NULL"
          } else {
              value = string(col) //ATTN : converted to string here
          }
          fmt.Println(columns[i], ": ", value)
      }
      fmt.Println("-----------------------------------")
  }
  </code></pre>
  
  <p>Is there a way to retain it as <code>interface{}</code> so I can do the necessary type casting while using the columns from <code>[]map[string]interface{}</code></p>