title: How to get the number of rows returned by a query using gocql
body: <p>I am using the gocql library which is documented here: <a href="https://godoc.org/github.com/relops/cqlc/cqlc#Fetchable" rel="nofollow">https://godoc.org/github.com/relops/cqlc/cqlc#Fetchable</a> and am trying to write an API call in golang that will ask for all of the elements in my database that fulfill a particular field and return the total number of elements returned. I know when I am in the Cassandra interface I can use the call <code>SELECT COUNT(*) from table1 WHERE ...;</code> where table1 is the table name. I have been going through the documentation and all I can find is the limit function that limits the number of entries that are returned.</p>
  
  <p>For example, just say I have a database table of events in Cassandra that take place on different days. I just want to return the number of events that take place on Tuesday, and I want to do this using gocql.</p>
  
  <p>Currently I do something like:</p>
  
  <pre><code>cx := cqlc.NewContext()
  iter, err := cx.Select().
              From(db.EVENTLOG).
              Where(db.EVENTLOG.DAY.Eq(day).
              Limit(10000).       
              Fetch(cass)
  data, err = db.BindEventlog(iter)
  </code></pre>
  
  <p>The BindEventLog function returns an array of the events that happen on 'day' but again, I just want the number of events, not the events themselves. Is there a way to get this without iterating through this array because I am anyways going to throw out the array so it would be really slow to get the database to give me the entire array of data.</p>
  
  <p>I am a beginner at this so if you need more information please ask, I tried to make this as specific as possible. Thanks.</p>