title: Golang Revel: Paginating a struct array
body: <p>I have a struct array that I need to paginate on the view end. </p>
  
  <p>This is what my code looks like on the view:</p>
  
  <pre><code>&lt;div class="tab-content"&gt;
          &lt;div class="tab-pane active" id="tab1" &gt;
            &lt;hr/&gt;
            {{range .c}}                
              &lt;p&gt;Number: {{.Number}}&lt;/p&gt;
              &lt;p&gt;Name: {{.Name}}&lt;/p&gt;
              &lt;p&gt;Parties: {{.A}} and {{.B}}&lt;/p&gt;
              &lt;p&gt;Location: {{.Location}}&lt;/p&gt;
            &lt;a href="/search"&gt;Read More&lt;/a&gt;
            &lt;hr/&gt;
            {{end}}
            &lt;div class="paging"&gt;
              &lt;ul class="pagination"&gt;
                &lt;li&gt;&lt;a href="#"&gt;&lt;i class="fa fa-angle-left"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
                &lt;li class="active"&gt;&lt;a href="#"&gt;1&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;2&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;3&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;4&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;5&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;&lt;i class="fa fa-angle-right"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>I have tried looking for solution to paginate this because the results are in the hundreds. The only golang solutions I have come across so far are SQL related. I would highly appreciate a solution for a struct array. </p>
  
  <p>Thank you in advance.</p>
  
  <p><strong>EDIT</strong> My back end storage is BoltDB. I get the data on the controller by calling this method</p>
  
  <pre><code>func List(bucket string)  []Data{
      //Open BoltDB database
      Open()
      defer Close()
      //Use a predefined struct to make an array
      d:=make([]Data, 0)
      //Fetch and unmarshal data as it is saved in byte form
      db.View(func(tx *bolt.Tx) error {
          cur := tx.Bucket([]byte(bucket)).Cursor()
          for k, v := cur.First(); k != nil; k, v = cur.Next() {            
              d1:=Data{}
              err:= json.Unmarshal(v, &amp;d1)
              if err !=nil{
                  return err
              }
              d=append(d, d1)
          } 
          return nil  
      })
      //Return the array of data
      return d
  }
  </code></pre>
  
  <p>This array is what I would like to iterate on the view.</p>