Skip to content

Commit

Permalink
Comment
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-artie committed Jun 26, 2024
1 parent 64f6bca commit 97d4da3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/debezium/decimal.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func EncodeDecimal(decimal *apd.Decimal) ([]byte, int32) {
return encodeBigInt(bigIntValue), -decimal.Exponent
}

// EncodeDecimalWithScale is used to encode a [apd.Decimal] to [org.apache.kafka.connect.data.Decimal]
// EncodeDecimalWithScale is used to encode a [apd.Decimal] to [org.apache.kafka.connect.data.Decimal].
// using a specific scale.
func EncodeDecimalWithScale(_decimal *apd.Decimal, scale int32) []byte {
targetExponent := -scale // Negate scale since [Decimal.Exponent] is negative.
Expand All @@ -84,7 +84,7 @@ func EncodeDecimalWithScale(_decimal *apd.Decimal, scale int32) []byte {
return bytes
}

// DecodeDecimal is used to decode `org.apache.kafka.connect.data.Decimal`.
// DecodeDecimal is used to decode [org.apache.kafka.connect.data.Decimal].
func DecodeDecimal(data []byte, precision *int, scale int) *decimal.Decimal {
_decimal := apd.NewWithBigInt(new(apd.BigInt).SetMathBigInt(decodeBigInt(data)), -int32(scale))
return decimal.NewDecimal(precision, scale, _decimal)
Expand Down

0 comments on commit 97d4da3

Please sign in to comment.