title: How to extract postgres timestamp range with Go?
body: <p>I have a database calendar with tsrange type from postgres. It allows me to have multiple appointments and time range such as :</p>
  
  <pre><code>["2018-11-08 10:00:00","2018-11-08 10:45:00"]
  </code></pre>
  
  <p>How do I store this value in a Go variable ?</p>
  
  <p>I tried </p>
  
  <pre><code>var tsrange []string
  </code></pre>
  
  <p>And when I log <code>tsrange[0]</code> it is empty. What is the proper type for it ?</p>
  
  <p>More code :</p>
  
  <pre><code>rows, err := db.Query("SELECT * FROM appointments")
  utils.CheckErr(err)
  
  var id int
  var userID int
  var tsrange []string
  
  rows.Next()
  err = rows.Scan(&amp;id, &amp;userID, &amp;tsrange)
  
  fmt.Println(tsrange[0])
  </code></pre>
  
  <p>When I replace <code>var tsrange []string</code> with <code>var tsrange string</code> the log is <code>["2018-11-08 10:00:00","2018-11-08 10:45:00"]</code>.</p>