title: Adding an array of integers as a data type in a Gorm Model
body: <p>I am trying to save an array of numbers in a single postgresql field using Gorm.</p>
  <p>The array needs to be a list with between 2 &amp; 13 numbers: [1, 2, 3, 5, 8, 13, 21, 40, 1000]</p>
  <p>Everything was working when saving a single int64. When I tried changing the model to account for an array of int64's it gives me the following error:</p>
  <p>&quot;panic: invalid sql type  (slice) for postgres&quot;</p>
  <p>my Gorm model is:</p>
  <pre><code>type Game struct {
      gorm.Model
      GameCode    string
      GameName    string
      DeckType    []int64
      GameEndDate string
  }
  </code></pre>
  <hr />
  <p>Update based on answer from @pacuna. I tried the suggested code and I get a similar error.</p>
  <p>&quot;panic: invalid sql type Int64Array (slice) for postgres&quot;</p>
  <p>Here is the full code block:</p>
  <pre><code>package main
  
  import (
      &quot;fmt&quot;
  
      &quot;github.com/jinzhu/gorm&quot;
      _ &quot;github.com/jinzhu/gorm/dialects/postgres&quot;
      pq &quot;github.com/lib/pq&quot;
  )
  
  var db *gorm.DB
  
  // Test -- Model for Game table
  type Test struct {
      gorm.Model                                           
      GameCode    string                                      
      GameName    string                                      
      DeckType    pq.Int64Array    
      GameEndDate string   
  }
  
  
  func main() {
      db, err := gorm.Open(&quot;postgres&quot;, &quot;host=localhost port=5432 user=fullstack dbname=scratch_game sslmode=disable&quot;)
      if err != nil {
          fmt.Println(err.Error())
          panic(&quot;Failed to connect to database...&quot;)
      }
      defer db.Close()
  
  
      dt := []int64{1, 2, 3}
  
  
      db.AutoMigrate(&amp;Test{})
      fmt.Println(&quot;Table Created&quot;)
  
      db.Create(&amp;Test{GameCode: &quot;xxx&quot;, GameName: &quot;xxx&quot;, DeckType: pq.Int64Array(dt), GameEndDate: &quot;xxx&quot;})
      fmt.Println(&quot;Record Added&quot;)
  }
  </code></pre>