File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -574,6 +574,10 @@ func (b *buffer) Float64Column(name string, val float64) *buffer {
574574}
575575
576576func (b * buffer ) DecimalColumnScaled (name string , val ScaledDecimal ) * buffer {
577+ if val .IsNull () {
578+ // Don't write null decimals
579+ return b
580+ }
577581 if ! b .prepareForField () {
578582 return b
579583 }
@@ -585,10 +589,6 @@ func (b *buffer) decimalColumnScaled(name string, val ScaledDecimal) *buffer {
585589 b .lastErr = err
586590 return b
587591 }
588- if val .IsNull () {
589- // Don't write null decimals
590- return b
591- }
592592 b .lastErr = b .writeColumnName (name )
593593 if b .lastErr != nil {
594594 return b
@@ -623,17 +623,24 @@ func (b *buffer) DecimalColumnString(name string, val string) *buffer {
623623}
624624
625625func (b * buffer ) DecimalColumnShopspring (name string , val ShopspringDecimal ) * buffer {
626- if ! b . prepareForField () {
626+ if val == nil {
627627 return b
628628 }
629- if val = = nil {
629+ if b . lastErr ! = nil {
630630 return b
631631 }
632632 dec , err := convertShopspringDecimal (val )
633633 if err != nil {
634634 b .lastErr = err
635635 return b
636636 }
637+ if dec .IsNull () {
638+ // Don't write null decimals
639+ return b
640+ }
641+ if ! b .prepareForField () {
642+ return b
643+ }
637644 return b .decimalColumnScaled (name , dec )
638645}
639646
You can’t perform that action at this time.
0 commit comments