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

Add gm float transformer #155

Merged
merged 4 commits into from
Feb 27, 2025
Merged

Add gm float transformer #155

merged 4 commits into from
Feb 27, 2025

Conversation

agedemenli
Copy link
Contributor

@agedemenli agedemenli commented Feb 21, 2025

Introduce FloatTransformer which uses greenmasktransformers.RandomFloat64Transformer under the hood.

@agedemenli agedemenli requested a review from eminano February 26, 2025 14:06
return float64(ret), nil
}

func getBytesForFloat(f float64) []byte {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It might be less verbose (and maybe a bit more readable) to use the encoding/binary library.

var buf [8]byte
binary.BigEndian.PutUint64(buf[:], math.Float64bits(f))

https://stackoverflow.com/a/43696189

Copy link

Merging this branch changes the coverage (1 decrease, 1 increase)

Impacted Packages Coverage Δ 🤖
github.com/xataio/pgstream/pkg/transformers 100.00% (ø)
github.com/xataio/pgstream/pkg/transformers/builder 14.81% (-1.85%) 👎
github.com/xataio/pgstream/pkg/transformers/greenmask 94.89% (+1.37%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/xataio/pgstream/pkg/transformers/builder/transformer_builder.go 14.81% (-1.85%) 27 (+3) 4 23 (+3) 👎
github.com/xataio/pgstream/pkg/transformers/greenmask/greenmask_float_transformer.go 96.55% (+96.55%) 29 (+29) 28 (+28) 1 (+1) 🌟
github.com/xataio/pgstream/pkg/transformers/transformer.go 100.00% (ø) 7 7 0

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/xataio/pgstream/pkg/transformers/greenmask/greenmask_float_transformer_test.go

@agedemenli agedemenli merged commit d2bf331 into main Feb 27, 2025
6 checks passed
@agedemenli agedemenli deleted the float-gm-transformer branch February 27, 2025 09:24
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.

None yet

2 participants