title: How to use rows.Scan of Go's database/sql
body: <p>I use database/sql and define a struct mapping to DB table columns(tag field):</p>
  
  <pre><code>// Users ...
  type Users struct {
      ID            int64  `field:"id"`                      
      Username      string `field:"username"`           
      Password      string `field:"password"`           
      Tel           string `field:"tel"`                   
  }
  </code></pre>
  
  <p>then I query:</p>
  
  <pre><code>        rows, err := db.Query(sql)  // select * from users
          if err != nil {
              fmt.Println(err)
          }
          defer rows.Close()
          for rows.Next() {
              user := new(Users)
  
              // works but I don't think it is good code for too many columns
              err = rows.Scan(&amp;user.ID, &amp;user.Username, &amp;user.Password, &amp;user.Tel)
  
              // TODO: How to scan in a simple way 
  
  
              if err != nil {
                  fmt.Println(err)
              }
              fmt.Println("user: ", user)
              list = append(list, *user)
          }
          if err := rows.Err(); err != nil {
              fmt.Println(err)
          }
  </code></pre>
  
  <p>As you can see for <code>rows.Scan()</code> , I have to write all columns , and I don't think it's a good way for 20 or more columns . </p>
  
  <p>How to scan in a clear way.</p>