title: Golang pass a slice of structs to a stored procedure as a array of user defined types
body: <p>I have a slice of structs that I want to pass into a stored procedure to be used as an array of user defined types t but I can't figure out a way of doing this is in Go.</p>
  <p>For example the structs in go:</p>
  <pre><code>type a struct {
      ID           int `db:&quot;id&quot;`
      Name         string `db:&quot;name&quot;`
      Created      time.Time `db:&quot;created&quot;`
      IsNew        bool   `db:&quot;is_new&quot;`
  }
  </code></pre>
  <p>And the create statement for the user defined type</p>
  <pre><code>CREATE TYPE custom_type AS
  (
      id int,
      name varchar,
      created timestamp,
      is_new boolean
  )
  </code></pre>
  <p>and then the stored procedure</p>
  <pre><code>create or replace procedure custom_procedure(
     input custom_type[]
  )
  </code></pre>
  <p>So far I have tried doing</p>
  <pre><code>func Save(records []a) error {
  _, err := p.client.Exec(&quot;CALL custom_procedure($1)&quot;, pq.Array(records))
  return err
  }
  </code></pre>
  <p>but I just get an error &quot;sql: converting argument $1 type: unsupported type a, a struct&quot;</p>