@@ -388,7 +388,7 @@ LIMIT 15;
388388}
389389
390390// https://github.com/go-jet/jet/issues/226
391- func TestGroupingBug226 (t * testing.T ) {
391+ func TestDuplicateSlicesInDestination (t * testing.T ) {
392392
393393 type Staffs struct {
394394 StaffList []model.Staff
@@ -397,8 +397,9 @@ func TestGroupingBug226(t *testing.T) {
397397 type MyStore struct {
398398 model.Store
399399
400- StaffList []model.Staff
401- Staffs Staffs
400+ StaffList []model.Staff
401+ StaffList2 []model.Staff
402+ Staffs Staffs
402403 }
403404
404405 stmt := SELECT (
@@ -438,6 +439,21 @@ func TestGroupingBug226(t *testing.T) {
438439 "Picture": "iVBORw0KWgo="
439440 }
440441 ],
442+ "StaffList2": [
443+ {
444+ "StaffID": 1,
445+ "FirstName": "Mike",
446+ "LastName": "Hillyer",
447+ "AddressID": 3,
448+ "Email": "Mike.Hillyer@sakilastaff.com",
449+ "StoreID": 1,
450+ "Active": true,
451+ "Username": "Mike",
452+ "Password": "8cb2237d0679ca88db6464eac60da96345513964",
453+ "LastUpdate": "2006-05-16T16:13:11.79328Z",
454+ "Picture": "iVBORw0KWgo="
455+ }
456+ ],
441457 "Staffs": {
442458 "StaffList": [
443459 {
@@ -476,6 +492,21 @@ func TestGroupingBug226(t *testing.T) {
476492 "Picture": null
477493 }
478494 ],
495+ "StaffList2": [
496+ {
497+ "StaffID": 2,
498+ "FirstName": "Jon",
499+ "LastName": "Stephens",
500+ "AddressID": 4,
501+ "Email": "Jon.Stephens@sakilastaff.com",
502+ "StoreID": 2,
503+ "Active": true,
504+ "Username": "Jon",
505+ "Password": "8cb2237d0679ca88db6464eac60da96345513964",
506+ "LastUpdate": "2006-05-16T16:13:11.79328Z",
507+ "Picture": null
508+ }
509+ ],
479510 "Staffs": {
480511 "StaffList": [
481512 {
@@ -543,15 +574,13 @@ ORDER BY city.city_id, address.address_id, customer.customer_id;
543574 Customers []struct {
544575 model.Customer
545576
546- Address [] model.Address
577+ Address model.Address
547578 }
548579 }
549580
550581 err := stmt .Query (db , & dest )
551582 require .NoError (t , err )
552583
553- testutils .PrintJson (dest )
554-
555584 require .Equal (t , len (dest ), 2 )
556585 require .Equal (t , dest [0 ].City .City , "London" )
557586 require .Equal (t , dest [1 ].City .City , "York" )
@@ -572,7 +601,7 @@ func TestExecution2(t *testing.T) {
572601 ID int32 `sql:"primary_key"`
573602 LastName * string
574603
575- Address [] MyAddress
604+ Address MyAddress
576605 }
577606
578607 type MyCity struct {
@@ -622,7 +651,6 @@ ORDER BY city.city_id, address.address_id, customer.customer_id;
622651 require .Equal (t , len (dest [0 ].Customers ), 2 )
623652 require .Equal (t , * dest [0 ].Customers [0 ].LastName , "Hoffman" )
624653 require .Equal (t , * dest [0 ].Customers [1 ].LastName , "Vines" )
625-
626654}
627655
628656func TestExecution3 (t * testing.T ) {
0 commit comments