Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move encodeDecimalWithScale from transfer #476

Merged
merged 2 commits into from
Aug 23, 2024

Conversation

nathan-artie
Copy link
Collaborator

@nathan-artie nathan-artie commented Aug 23, 2024

Copy decimalWithNewExponent and encodeDecimalWithScale from transfer so that they can be removed from transfer.

Since decimalWithNewExponent is somewhat opinionated (it truncates extra digits rather rounding or returning an error) it makes more sense to have it reader where it is used so that we can decide which behavior is ideal.

"github.com/artie-labs/transfer/lib/debezium"
"github.com/artie-labs/transfer/lib/typing"
"github.com/cockroachdb/apd/v3"
)

// decimalWithNewExponent takes a [*apd.Decimal] and returns a new [*apd.Decimal] with a the given exponent.
Copy link
Collaborator Author

@nathan-artie nathan-artie Aug 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No changes to these two functions.

@nathan-artie nathan-artie marked this pull request as ready for review August 23, 2024 22:25
@nathan-artie nathan-artie changed the title Copy encodeDecimalWithScale from transfer Move encodeDecimalWithScale from transfer Aug 23, 2024
"github.com/stretchr/testify/assert"
)

func TestDecimalWithNewExponent(t *testing.T) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No changes to these tests other than changing the case of encodeDecimalWithScale.

@nathan-artie nathan-artie merged commit 6bcc8b9 into master Aug 23, 2024
6 checks passed
@nathan-artie nathan-artie deleted the nv/move-encode-decimal-with-scale branch August 23, 2024 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants