@@ -40,6 +40,11 @@ func TestColumnsToStruct(t *testing.T) {
4040 DataType : "text" ,
4141 NotNull : true ,
4242 },
43+ {
44+ Name : "languages" ,
45+ DataType : "text" ,
46+ IsArray : true ,
47+ },
4348 }
4449
4550 // all of the columns are on the 'foo' table
@@ -55,8 +60,16 @@ func TestColumnsToStruct(t *testing.T) {
5560 Column : "foo.retyped" ,
5661 }
5762 o .Parse ()
63+
64+ // set up column-based array override test
65+ oa := Override {
66+ GoType : "github.com/lib/pq.StringArray" ,
67+ Column : "foo.languages" ,
68+ }
69+ oa .Parse ()
70+
5871 r .packageSettings = PackageSettings {
59- Overrides : []Override {o },
72+ Overrides : []Override {o , oa },
6073 }
6174
6275 actual := r .columnsToStruct ("Foo" , cols )
@@ -69,6 +82,7 @@ func TestColumnsToStruct(t *testing.T) {
6982 {Name : "Tags" , Type : "[]string" , Tags : map [string ]string {"json:" : "tags" }},
7083 {Name : "ByteSeq" , Type : "[]byte" , Tags : map [string ]string {"json:" : "byte_seq" }},
7184 {Name : "Retyped" , Type : "pkg.CustomType" , Tags : map [string ]string {"json:" : "retyped" }},
85+ {Name : "Languages" , Type : "pq.StringArray" , Tags : map [string ]string {"json:" : "languages" }},
7286 },
7387 }
7488 if diff := cmp .Diff (expected , actual ); diff != "" {
0 commit comments