Skip to content

Commit dca4259

Browse files
authored
Remove default value assignments for nil checks in processBatch function (#41)
1 parent 3c951c3 commit dca4259

File tree

1 file changed

+0
-37
lines changed

1 file changed

+0
-37
lines changed

core/dbio/database/database_proton.go

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
462462
}
463463
eG.Capture(err)
464464
} else {
465-
row[colI] = decimal.Zero
466465
g.Debug("decimal if value == nil")
467466
}
468467
}
@@ -472,7 +471,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
472471
row[colI], err = cast.ToBoolE(row[colI])
473472
eG.Capture(err)
474473
} else {
475-
row[colI] = false
476474
g.Debug("boolean if value == nil")
477475
}
478476
}
@@ -482,7 +480,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
482480
row[colI], err = cast.ToStringE(row[colI])
483481
eG.Capture(err)
484482
} else {
485-
row[colI] = ""
486483
g.Debug("string if value == nil")
487484
}
488485
}
@@ -492,7 +489,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
492489
row[colI], err = cast.ToInt8E(row[colI])
493490
eG.Capture(err)
494491
} else {
495-
row[colI] = int8(0)
496492
g.Debug("int8 if value == nil")
497493
}
498494
}
@@ -502,7 +498,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
502498
row[colI], err = cast.ToInt16E(row[colI])
503499
eG.Capture(err)
504500
} else {
505-
row[colI] = int16(0)
506501
g.Debug("int16 if value == nil")
507502
}
508503
}
@@ -512,7 +507,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
512507
row[colI], err = cast.ToInt32E(row[colI])
513508
eG.Capture(err)
514509
} else {
515-
row[colI] = int32(0)
516510
g.Debug("int32 if value == nil")
517511
}
518512
}
@@ -523,7 +517,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
523517
row[colI], err = cast.ToIntE(row[colI])
524518
eG.Capture(err)
525519
} else {
526-
row[colI] = int(0)
527520
g.Debug("int if value == nil")
528521
}
529522
}
@@ -534,7 +527,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
534527
row[colI], err = cast.ToInt64E(row[colI])
535528
eG.Capture(err)
536529
} else {
537-
row[colI] = int64(0)
538530
g.Debug("int64 if value == nil")
539531
}
540532
}
@@ -544,7 +536,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
544536
row[colI], err = cast.ToUint8E(row[colI])
545537
eG.Capture(err)
546538
} else {
547-
row[colI] = uint8(0)
548539
g.Debug("uint8 if value == nil")
549540
}
550541
}
@@ -554,7 +545,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
554545
row[colI], err = cast.ToUint16E(row[colI])
555546
eG.Capture(err)
556547
} else {
557-
row[colI] = uint16(0)
558548
g.Debug("uint16 if value == nil")
559549
}
560550
}
@@ -565,7 +555,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
565555
row[colI], err = cast.ToUint32E(row[colI])
566556
eG.Capture(err)
567557
} else {
568-
row[colI] = uint32(0)
569558
g.Debug("uint32 if value == nil")
570559
}
571560
}
@@ -576,7 +565,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
576565
row[colI], err = cast.ToUint64E(row[colI])
577566
eG.Capture(err)
578567
} else {
579-
row[colI] = uint64(0)
580568
g.Debug("uint64 if value == nil")
581569
}
582570
}
@@ -587,7 +575,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
587575
row[colI], err = cast.ToFloat64E(row[colI])
588576
eG.Capture(err)
589577
} else {
590-
row[colI] = float64(0)
591578
g.Debug("float64 if value == nil")
592579
}
593580
}
@@ -597,7 +584,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
597584
row[colI], err = cast.ToFloat32E(row[colI])
598585
eG.Capture(err)
599586
} else {
600-
row[colI] = float32(0)
601587
g.Debug("float32 if value == nil")
602588
}
603589
}
@@ -607,7 +593,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
607593
row[colI], err = cast.ToFloat64E(row[colI])
608594
eG.Capture(err)
609595
} else {
610-
row[colI] = float64(0)
611596
g.Debug("float64 if value == nil")
612597
}
613598
}
@@ -617,7 +602,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
617602
row[colI], err = conn.convertToArrayString(row[colI])
618603
eG.Capture(err)
619604
} else {
620-
row[colI] = []string{}
621605
g.Debug("empty arraystring if value == nil")
622606
}
623607
}
@@ -627,7 +611,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
627611
row[colI], err = conn.convertToArrayBool(row[colI])
628612
eG.Capture(err)
629613
} else {
630-
row[colI] = []bool{}
631614
g.Debug("empty arrayboolean if value == nil")
632615
}
633616
}
@@ -637,7 +620,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
637620
row[colI], err = conn.convertToArrayInt8(row[colI])
638621
eG.Capture(err)
639622
} else {
640-
row[colI] = []int8{}
641623
g.Debug("empty arrayint8 if value == nil")
642624
}
643625
}
@@ -647,7 +629,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
647629
row[colI], err = conn.convertToArrayInt16(row[colI])
648630
eG.Capture(err)
649631
} else {
650-
row[colI] = []int16{}
651632
g.Debug("empty arrayint16 if value == nil")
652633
}
653634
}
@@ -657,7 +638,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
657638
row[colI], err = conn.convertToArrayInt32(row[colI])
658639
eG.Capture(err)
659640
} else {
660-
row[colI] = []int32{}
661641
g.Debug("empty arrayint32 if value == nil")
662642
}
663643
}
@@ -667,7 +647,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
667647
row[colI], err = conn.convertToArrayInt64(row[colI])
668648
eG.Capture(err)
669649
} else {
670-
row[colI] = []int64{}
671650
g.Debug("empty arrayint64 if value == nil")
672651
}
673652
}
@@ -677,7 +656,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
677656
row[colI], err = conn.convertToArrayUint8(row[colI])
678657
eG.Capture(err)
679658
} else {
680-
row[colI] = []uint8{}
681659
g.Debug("empty arrayuint8 if value == nil")
682660
}
683661
}
@@ -687,7 +665,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
687665
row[colI], err = conn.convertToArrayUint16(row[colI])
688666
eG.Capture(err)
689667
} else {
690-
row[colI] = []uint16{}
691668
g.Debug("empty arrayuint16 if value == nil")
692669
}
693670
}
@@ -697,7 +674,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
697674
row[colI], err = conn.convertToArrayUint32(row[colI])
698675
eG.Capture(err)
699676
} else {
700-
row[colI] = []uint32{}
701677
g.Debug("empty arrayuint32 if value == nil")
702678
}
703679
}
@@ -707,7 +683,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
707683
row[colI], err = conn.convertToArrayUint64(row[colI])
708684
eG.Capture(err)
709685
} else {
710-
row[colI] = []uint64{}
711686
g.Debug("empty arrayuint64 if value == nil")
712687
}
713688
}
@@ -717,7 +692,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
717692
row[colI], err = conn.convertToArrayFloat32(row[colI])
718693
eG.Capture(err)
719694
} else {
720-
row[colI] = []float32{}
721695
g.Debug("empty arrayfloat32 if value == nil")
722696
}
723697
}
@@ -727,7 +701,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
727701
row[colI], err = conn.convertToArrayFloat64(row[colI])
728702
eG.Capture(err)
729703
} else {
730-
row[colI] = []float64{}
731704
g.Debug("empty arrayfloat64 if value == nil")
732705
}
733706
}
@@ -737,7 +710,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
737710
row[colI], err = conn.convertToMapStringString(row[colI])
738711
eG.Capture(err)
739712
} else {
740-
row[colI] = map[string]string{}
741713
g.Debug("empty mapstringstring if value == nil")
742714
}
743715
}
@@ -747,7 +719,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
747719
row[colI], err = conn.convertToMapStringInt32(row[colI])
748720
eG.Capture(err)
749721
} else {
750-
row[colI] = map[string]int32{}
751722
g.Debug("empty mapstringint32 if value == nil")
752723
}
753724
}
@@ -757,7 +728,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
757728
row[colI], err = conn.convertToMapStringInt64(row[colI])
758729
eG.Capture(err)
759730
} else {
760-
row[colI] = map[string]int64{}
761731
g.Debug("empty mapstringint64 if value == nil")
762732
}
763733
}
@@ -767,7 +737,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
767737
row[colI], err = conn.convertToMapStringUint32(row[colI])
768738
eG.Capture(err)
769739
} else {
770-
row[colI] = map[string]uint32{}
771740
g.Debug("empty mapstringuint32 if value == nil")
772741
}
773742
}
@@ -777,7 +746,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
777746
row[colI], err = conn.convertToMapStringUint64(row[colI])
778747
eG.Capture(err)
779748
} else {
780-
row[colI] = map[string]uint64{}
781749
g.Debug("empty mapstringuint64 if value == nil")
782750
}
783751
}
@@ -787,7 +755,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
787755
row[colI], err = conn.convertToMapStringFloat64(row[colI])
788756
eG.Capture(err)
789757
} else {
790-
row[colI] = map[string]float64{}
791758
g.Debug("empty mapstringfloat64 if value == nil")
792759
}
793760
}
@@ -797,7 +764,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
797764
row[colI], err = conn.convertToMapStringFloat32(row[colI])
798765
eG.Capture(err)
799766
} else {
800-
row[colI] = map[string]float32{}
801767
g.Debug("empty mapstringfloat32 if value == nil")
802768
}
803769
}
@@ -807,7 +773,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
807773
row[colI], err = conn.convertToMapStringArrayString(row[colI])
808774
eG.Capture(err)
809775
} else {
810-
row[colI] = map[string][]string{}
811776
g.Debug("empty mapstringarraystring if value == nil")
812777
}
813778
}
@@ -817,7 +782,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
817782
row[colI], err = conn.convertToMapInt32String(row[colI])
818783
eG.Capture(err)
819784
} else {
820-
row[colI] = map[int32]string{}
821785
g.Debug("empty mapint32string if value == nil")
822786
}
823787
}
@@ -827,7 +791,6 @@ func (conn *ProtonConn) processBatch(tableFName string, table Table, batch *iop.
827791
row[colI], err = conn.convertToMapInt64String(row[colI])
828792
eG.Capture(err)
829793
} else {
830-
row[colI] = map[int64]string{}
831794
g.Debug("empty mapint64string if value == nil")
832795
}
833796
}

0 commit comments

Comments
 (0)