title: Is it possible to dump golang db.Query() output to a string?
body: <p>I have a small Heroku app in which i print out name and age from each rows after query execution.</p>
  
  <p>I want to avoid looping rows.Next(),Scan().. and just want to show what database returned after query execution which may be some data or error.</p>
  
  <p>Can we directly dump data to a string for printing? </p>
  
  <pre><code>rows, err := db.Query("SELECT name FROM users WHERE age = $1", age)
  
  if err != nil {
      log.Fatal(err)
  }
  for rows.Next() {
      var name string
      if err := rows.Scan(&amp;name); err != nil {
          log.Fatal(err)
      }
      fmt.Printf("%s is %d\n", name, age)
  }
  if err := rows.Err(); err != nil {
      log.Fatal(err)
  }
  </code></pre>