@@ -264,7 +264,7 @@ func generateFPCode(pkg, dataTypes, imports string, structToFieldsMapUnexpected
264
264
template = r .Replace (template )
265
265
266
266
// it collects info of members of struct other than basic types
267
- unexpectedFieldsForDistinct := structToFieldsMapUnexpected [t ]
267
+ complextFieldsInStructSuchAsSlice := structToFieldsMapUnexpected [t ]
268
268
269
269
if len (onlyList ) > 0 {
270
270
// Always include these functions
@@ -485,7 +485,7 @@ func generateFPCode(pkg, dataTypes, imports string, structToFieldsMapUnexpected
485
485
template = r2 .Replace (template )
486
486
}
487
487
488
- if len (unexpectedFieldsForDistinct ) > 1 {
488
+ if len (complextFieldsInStructSuchAsSlice ) > 1 {
489
489
switchTemplateDistinct = true
490
490
491
491
if fp .ExistsStrIgnoreCase ("DistinctP" , onlyList ) {
@@ -508,6 +508,66 @@ func generateFPCode(pkg, dataTypes, imports string, structToFieldsMapUnexpected
508
508
template = r2 .Replace (template )
509
509
}
510
510
511
+ if fp .ExistsStrIgnoreCase ("Union" , onlyList ) {
512
+ template += basic .Union2 ()
513
+ template = r2 .Replace (template )
514
+ }
515
+
516
+ if fp .ExistsStrIgnoreCase ("UnionPtr" , onlyList ) {
517
+ template += basic .Union2Ptr ()
518
+ template = r2 .Replace (template )
519
+ }
520
+
521
+ if fp .ExistsStrIgnoreCase ("Intersection" , onlyList ) {
522
+ template += basic .Intersection2 ()
523
+ template = r2 .Replace (template )
524
+ }
525
+
526
+ if fp .ExistsStrIgnoreCase ("IntersectionPtr" , onlyList ) {
527
+ template += basic .IntersectionPtr2 ()
528
+ template = r2 .Replace (template )
529
+ }
530
+
531
+ if fp .ExistsStrIgnoreCase ("Difference" , onlyList ) {
532
+ template += basic .Difference2 ()
533
+ template = r2 .Replace (template )
534
+ }
535
+
536
+ if fp .ExistsStrIgnoreCase ("DifferencePtr" , onlyList ) {
537
+ template += basic .DifferencePtr2 ()
538
+ template = r2 .Replace (template )
539
+ }
540
+
541
+ if fp .ExistsStrIgnoreCase ("Subset" , onlyList ) {
542
+ template += basic .Subset2 ()
543
+ template = r2 .Replace (template )
544
+ }
545
+
546
+ if fp .ExistsStrIgnoreCase ("SubsetPtr" , onlyList ) {
547
+ template += basic .SubsetPtr2 ()
548
+ template = r2 .Replace (template )
549
+ }
550
+
551
+ if fp .ExistsStrIgnoreCase ("Superset" , onlyList ) {
552
+ template += basic .Superset2 ()
553
+ template = r2 .Replace (template )
554
+ }
555
+
556
+ if fp .ExistsStrIgnoreCase ("SupersetPtr" , onlyList ) {
557
+ template += basic .SupersetPtr2 ()
558
+ template = r2 .Replace (template )
559
+ }
560
+
561
+ if fp .ExistsStrIgnoreCase ("Set" , onlyList ) {
562
+ template += basic .Set2 ()
563
+ template = r2 .Replace (template )
564
+ }
565
+
566
+ if fp .ExistsStrIgnoreCase ("SetPtr" , onlyList ) {
567
+ template += basic .SetPtr2 ()
568
+ template = r2 .Replace (template )
569
+ }
570
+
511
571
} else {
512
572
if fp .ExistsStrIgnoreCase ("DistinctP" , onlyList ) {
513
573
template += basic .DistinctP ()
@@ -528,6 +588,66 @@ func generateFPCode(pkg, dataTypes, imports string, structToFieldsMapUnexpected
528
588
template += basic .DistinctPtr ()
529
589
template = r2 .Replace (template )
530
590
}
591
+
592
+ if fp .ExistsStrIgnoreCase ("Union" , onlyList ) {
593
+ template += basic .Union ()
594
+ template = r2 .Replace (template )
595
+ }
596
+
597
+ if fp .ExistsStrIgnoreCase ("UnionPtr" , onlyList ) {
598
+ template += basic .UnionPtr ()
599
+ template = r2 .Replace (template )
600
+ }
601
+
602
+ if fp .ExistsStrIgnoreCase ("Intersection" , onlyList ) {
603
+ template += basic .Intersection ()
604
+ template = r2 .Replace (template )
605
+ }
606
+
607
+ if fp .ExistsStrIgnoreCase ("IntersectionPtr" , onlyList ) {
608
+ template += basic .IntersectionPtr ()
609
+ template = r2 .Replace (template )
610
+ }
611
+
612
+ if fp .ExistsStrIgnoreCase ("Difference" , onlyList ) {
613
+ template += basic .Difference ()
614
+ template = r2 .Replace (template )
615
+ }
616
+
617
+ if fp .ExistsStrIgnoreCase ("DifferencePtr" , onlyList ) {
618
+ template += basic .DifferencePtr ()
619
+ template = r2 .Replace (template )
620
+ }
621
+
622
+ if fp .ExistsStrIgnoreCase ("Subset" , onlyList ) {
623
+ template += basic .Subset ()
624
+ template = r2 .Replace (template )
625
+ }
626
+
627
+ if fp .ExistsStrIgnoreCase ("SubsetPtr" , onlyList ) {
628
+ template += basic .SubsetPtr ()
629
+ template = r2 .Replace (template )
630
+ }
631
+
632
+ if fp .ExistsStrIgnoreCase ("Superset" , onlyList ) {
633
+ template += basic .Superset ()
634
+ template = r2 .Replace (template )
635
+ }
636
+
637
+ if fp .ExistsStrIgnoreCase ("SupersetPtr" , onlyList ) {
638
+ template += basic .SupersetPtr ()
639
+ template = r2 .Replace (template )
640
+ }
641
+
642
+ if fp .ExistsStrIgnoreCase ("Set" , onlyList ) {
643
+ template += basic .Set ()
644
+ template = r2 .Replace (template )
645
+ }
646
+
647
+ if fp .ExistsStrIgnoreCase ("SetPtr" , onlyList ) {
648
+ template += basic .SetPtr ()
649
+ template = r2 .Replace (template )
650
+ }
531
651
}
532
652
533
653
} else {
@@ -675,7 +795,8 @@ func generateFPCode(pkg, dataTypes, imports string, structToFieldsMapUnexpected
675
795
template += basic .TakePtr ()
676
796
template = r2 .Replace (template )
677
797
678
- if len (unexpectedFieldsForDistinct ) > 1 {
798
+ // if struct's has member of type other than basic types such as list then use template which uses reflect
799
+ if len (complextFieldsInStructSuchAsSlice ) > 1 {
679
800
switchTemplateDistinct = true
680
801
681
802
template += basic .DistinctP2 ()
@@ -690,6 +811,42 @@ func generateFPCode(pkg, dataTypes, imports string, structToFieldsMapUnexpected
690
811
template += basic .DistinctPtr2 ()
691
812
template = r2 .Replace (template )
692
813
814
+ template += basic .Union2 ()
815
+ template = r2 .Replace (template )
816
+
817
+ template += basic .Union2Ptr ()
818
+ template = r2 .Replace (template )
819
+
820
+ template += basic .Intersection2 ()
821
+ template = r2 .Replace (template )
822
+
823
+ template += basic .IntersectionPtr2 ()
824
+ template = r2 .Replace (template )
825
+
826
+ template += basic .Difference2 ()
827
+ template = r2 .Replace (template )
828
+
829
+ template += basic .DifferencePtr2 ()
830
+ template = r2 .Replace (template )
831
+
832
+ template += basic .Subset2 ()
833
+ template = r2 .Replace (template )
834
+
835
+ template += basic .SubsetPtr2 ()
836
+ template = r2 .Replace (template )
837
+
838
+ template += basic .Superset2 ()
839
+ template = r2 .Replace (template )
840
+
841
+ template += basic .SupersetPtr2 ()
842
+ template = r2 .Replace (template )
843
+
844
+ template += basic .Set2 ()
845
+ template = r2 .Replace (template )
846
+
847
+ template += basic .SetPtr2 ()
848
+ template = r2 .Replace (template )
849
+
693
850
} else {
694
851
template += basic .DistinctP ()
695
852
template = r2 .Replace (template )
@@ -702,6 +859,42 @@ func generateFPCode(pkg, dataTypes, imports string, structToFieldsMapUnexpected
702
859
703
860
template += basic .DistinctPtr ()
704
861
template = r2 .Replace (template )
862
+
863
+ template += basic .Union ()
864
+ template = r2 .Replace (template )
865
+
866
+ template += basic .UnionPtr ()
867
+ template = r2 .Replace (template )
868
+
869
+ template += basic .Intersection ()
870
+ template = r2 .Replace (template )
871
+
872
+ template += basic .IntersectionPtr ()
873
+ template = r2 .Replace (template )
874
+
875
+ template += basic .Difference ()
876
+ template = r2 .Replace (template )
877
+
878
+ template += basic .DifferencePtr ()
879
+ template = r2 .Replace (template )
880
+
881
+ template += basic .Subset ()
882
+ template = r2 .Replace (template )
883
+
884
+ template += basic .SubsetPtr ()
885
+ template = r2 .Replace (template )
886
+
887
+ template += basic .Superset ()
888
+ template = r2 .Replace (template )
889
+
890
+ template += basic .SupersetPtr ()
891
+ template = r2 .Replace (template )
892
+
893
+ template += basic .Set ()
894
+ template = r2 .Replace (template )
895
+
896
+ template += basic .SetPtr ()
897
+ template = r2 .Replace (template )
705
898
}
706
899
}
707
900
}
0 commit comments