Repository: xataio/pgstream
Pull request #154 (2025-02-20 14:10:50)

Add gm integer transformer
This PR introduces `IntegerTransformer` which uses `greenmasktransformers.RandomInt64Transformer` under the hood.

github-actions[bot]: ### Merging this branch will **decrease** overall coverage

| Impacted Packages | Coverage Δ | :robot: |
|-------------------|------------|---------|
| github.com/xataio/pgstream/pkg/transformers | 100.00% (ø) |  |
| github.com/xataio/pgstream/pkg/transformers/builder | 16.67% (**-2.38%**) | :thumbsdown: |
| github.com/xataio/pgstream/pkg/transformers/greenmask | 87.00% (**-5.19%**) | :thumbsdown: |

---

<details>

<summary>Coverage by file</summary>

### Changed files (no unit tests)

| Changed File | Coverage Δ | Total | Covered | Missed | :robot: |
|--------------|------------|-------|---------|--------|---------|
| github.com/xataio/pgstream/pkg/transformers/builder/transformer_builder.go | 16.67% (**-2.38%**) | 24 (+3) | 4 | 20 (+3) | :thumbsdown: |
| github.com/xataio/pgstream/pkg/transformers/greenmask/greenmask_integer_transformer.go | 77.78% (**+77.78%**) | 36 (+36) | 28 (+28) | 8 (+8) | :star2: |
| 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_integer_transformer_test.go

</details>

github-actions[bot]: ### Merging this branch will **decrease** overall coverage

| Impacted Packages | Coverage Δ | :robot: |
|-------------------|------------|---------|
| github.com/xataio/pgstream/pkg/transformers | 100.00% (ø) |  |
| github.com/xataio/pgstream/pkg/transformers/builder | 16.67% (**-2.38%**) | :thumbsdown: |
| github.com/xataio/pgstream/pkg/transformers/greenmask | 90.82% (**-1.37%**) | :thumbsdown: |

---

<details>

<summary>Coverage by file</summary>

### Changed files (no unit tests)

| Changed File | Coverage Δ | Total | Covered | Missed | :robot: |
|--------------|------------|-------|---------|--------|---------|
| github.com/xataio/pgstream/pkg/transformers/builder/transformer_builder.go | 16.67% (**-2.38%**) | 24 (+3) | 4 | 20 (+3) | :thumbsdown: |
| github.com/xataio/pgstream/pkg/transformers/greenmask/greenmask_integer_transformer.go | 88.24% (**+88.24%**) | 34 (+34) | 30 (+30) | 4 (+4) | :star2: |
| 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_integer_transformer_test.go

</details>

github-actions[bot]: ### Merging this branch will **decrease** overall coverage

| Impacted Packages | Coverage Δ | :robot: |
|-------------------|------------|---------|
| github.com/xataio/pgstream/pkg/transformers | 100.00% (ø) |  |
| github.com/xataio/pgstream/pkg/transformers/builder | 16.67% (**-2.38%**) | :thumbsdown: |
| github.com/xataio/pgstream/pkg/transformers/greenmask | 90.82% (**-1.37%**) | :thumbsdown: |

---

<details>

<summary>Coverage by file</summary>

### Changed files (no unit tests)

| Changed File | Coverage Δ | Total | Covered | Missed | :robot: |
|--------------|------------|-------|---------|--------|---------|
| github.com/xataio/pgstream/pkg/transformers/builder/transformer_builder.go | 16.67% (**-2.38%**) | 24 (+3) | 4 | 20 (+3) | :thumbsdown: |
| github.com/xataio/pgstream/pkg/transformers/greenmask/greenmask_integer_transformer.go | 88.24% (**+88.24%**) | 34 (+34) | 30 (+30) | 4 (+4) | :star2: |
| 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_integer_transformer_test.go

</details>

github-actions[bot]: ### Merging this branch will **decrease** overall coverage

| Impacted Packages | Coverage Δ | :robot: |
|-------------------|------------|---------|
| github.com/xataio/pgstream/pkg/transformers | 100.00% (ø) |  |
| github.com/xataio/pgstream/pkg/transformers/builder | 16.67% (**-2.38%**) | :thumbsdown: |
| github.com/xataio/pgstream/pkg/transformers/greenmask | 87.50% (**-4.69%**) | :thumbsdown: |

---

<details>

<summary>Coverage by file</summary>

### Changed files (no unit tests)

| Changed File | Coverage Δ | Total | Covered | Missed | :robot: |
|--------------|------------|-------|---------|--------|---------|
| github.com/xataio/pgstream/pkg/transformers/builder/transformer_builder.go | 16.67% (**-2.38%**) | 24 (+3) | 4 | 20 (+3) | :thumbsdown: |
| github.com/xataio/pgstream/pkg/transformers/greenmask/greenmask_integer_transformer.go | 80.00% (**+80.00%**) | 40 (+40) | 32 (+32) | 8 (+8) | :star2: |
| 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_integer_transformer_test.go

</details>

github-actions[bot]: ### Merging this branch changes the coverage (1 decrease, 1 increase)

| Impacted Packages | Coverage Δ | :robot: |
|-------------------|------------|---------|
| github.com/xataio/pgstream/pkg/transformers | 100.00% (ø) |  |
| github.com/xataio/pgstream/pkg/transformers/builder | 16.67% (**-2.38%**) | :thumbsdown: |
| github.com/xataio/pgstream/pkg/transformers/greenmask | 94.23% (**+2.04%**) | :thumbsup: |

---

<details>

<summary>Coverage by file</summary>

### Changed files (no unit tests)

| Changed File | Coverage Δ | Total | Covered | Missed | :robot: |
|--------------|------------|-------|---------|--------|---------|
| github.com/xataio/pgstream/pkg/transformers/builder/transformer_builder.go | 16.67% (**-2.38%**) | 24 (+3) | 4 | 20 (+3) | :thumbsdown: |
| github.com/xataio/pgstream/pkg/transformers/greenmask/greenmask_integer_transformer.go | 97.50% (**+97.50%**) | 40 (+40) | 39 (+39) | 1 (+1) | :star2: |
| 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_integer_transformer_test.go

</details>

github-actions[bot]: ### Merging this branch changes the coverage (1 decrease, 1 increase)

| Impacted Packages | Coverage Δ | :robot: |
|-------------------|------------|---------|
| github.com/xataio/pgstream/pkg/transformers | 100.00% (ø) |  |
| github.com/xataio/pgstream/pkg/transformers/builder | 16.67% (**-2.38%**) | :thumbsdown: |
| github.com/xataio/pgstream/pkg/transformers/greenmask | 94.34% (**+2.15%**) | :thumbsup: |

---

<details>

<summary>Coverage by file</summary>

### Changed files (no unit tests)

| Changed File | Coverage Δ | Total | Covered | Missed | :robot: |
|--------------|------------|-------|---------|--------|---------|
| github.com/xataio/pgstream/pkg/transformers/builder/transformer_builder.go | 16.67% (**-2.38%**) | 24 (+3) | 4 | 20 (+3) | :thumbsdown: |
| github.com/xataio/pgstream/pkg/transformers/greenmask/greenmask_integer_transformer.go | 97.62% (**+97.62%**) | 42 (+42) | 41 (+41) | 1 (+1) | :star2: |
| 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_integer_transformer_test.go

</details>

github-actions[bot]: ### Merging this branch changes the coverage (1 decrease, 1 increase)

| Impacted Packages | Coverage Δ | :robot: |
|-------------------|------------|---------|
| github.com/xataio/pgstream/pkg/transformers | 100.00% (ø) |  |
| github.com/xataio/pgstream/pkg/transformers/builder | 16.67% (**-2.38%**) | :thumbsdown: |
| github.com/xataio/pgstream/pkg/transformers/greenmask | 94.34% (**+2.15%**) | :thumbsup: |

---

<details>

<summary>Coverage by file</summary>

### Changed files (no unit tests)

| Changed File | Coverage Δ | Total | Covered | Missed | :robot: |
|--------------|------------|-------|---------|--------|---------|
| github.com/xataio/pgstream/pkg/transformers/builder/transformer_builder.go | 16.67% (**-2.38%**) | 24 (+3) | 4 | 20 (+3) | :thumbsdown: |
| github.com/xataio/pgstream/pkg/transformers/greenmask/greenmask_integer_transformer.go | 97.62% (**+97.62%**) | 42 (+42) | 41 (+41) | 1 (+1) | :star2: |
| 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_integer_transformer_test.go

</details>

github-actions[bot]: ### Merging this branch changes the coverage (1 decrease, 1 increase)

| Impacted Packages | Coverage Δ | :robot: |
|-------------------|------------|---------|
| github.com/xataio/pgstream/pkg/transformers | 100.00% (ø) |  |
| github.com/xataio/pgstream/pkg/transformers/builder | 16.67% (**-2.38%**) | :thumbsdown: |
| github.com/xataio/pgstream/pkg/transformers/greenmask | 93.52% (**+1.33%**) | :thumbsup: |

---

<details>

<summary>Coverage by file</summary>

### Changed files (no unit tests)

| Changed File | Coverage Δ | Total | Covered | Missed | :robot: |
|--------------|------------|-------|---------|--------|---------|
| github.com/xataio/pgstream/pkg/transformers/builder/transformer_builder.go | 16.67% (**-2.38%**) | 24 (+3) | 4 | 20 (+3) | :thumbsdown: |
| github.com/xataio/pgstream/pkg/transformers/greenmask/greenmask_integer_transformer.go | 95.45% (**+95.45%**) | 44 (+44) | 42 (+42) | 2 (+2) | :star2: |
| 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_integer_transformer_test.go

</details>

github-actions[bot]: ### Merging this branch changes the coverage (1 decrease, 1 increase)

| Impacted Packages | Coverage Δ | :robot: |
|-------------------|------------|---------|
| github.com/xataio/pgstream/pkg/transformers | 100.00% (ø) |  |
| github.com/xataio/pgstream/pkg/transformers/builder | 16.67% (**-2.38%**) | :thumbsdown: |
| github.com/xataio/pgstream/pkg/transformers/greenmask | 93.52% (**+1.33%**) | :thumbsup: |

---

<details>

<summary>Coverage by file</summary>

### Changed files (no unit tests)

| Changed File | Coverage Δ | Total | Covered | Missed | :robot: |
|--------------|------------|-------|---------|--------|---------|
| github.com/xataio/pgstream/pkg/transformers/builder/transformer_builder.go | 16.67% (**-2.38%**) | 24 (+3) | 4 | 20 (+3) | :thumbsdown: |
| github.com/xataio/pgstream/pkg/transformers/greenmask/greenmask_integer_transformer.go | 95.45% (**+95.45%**) | 44 (+44) | 42 (+42) | 2 (+2) | :star2: |
| 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_integer_transformer_test.go

</details>

github-actions[bot]: ### Merging this branch changes the coverage (1 decrease, 1 increase)

| Impacted Packages | Coverage Δ | :robot: |
|-------------------|------------|---------|
| github.com/xataio/pgstream/pkg/transformers | 100.00% (ø) |  |
| github.com/xataio/pgstream/pkg/transformers/builder | 16.67% (**-2.38%**) | :thumbsdown: |
| github.com/xataio/pgstream/pkg/transformers/greenmask | 93.52% (**+1.33%**) | :thumbsup: |

---

<details>

<summary>Coverage by file</summary>

### Changed files (no unit tests)

| Changed File | Coverage Δ | Total | Covered | Missed | :robot: |
|--------------|------------|-------|---------|--------|---------|
| github.com/xataio/pgstream/pkg/transformers/builder/transformer_builder.go | 16.67% (**-2.38%**) | 24 (+3) | 4 | 20 (+3) | :thumbsdown: |
| github.com/xataio/pgstream/pkg/transformers/greenmask/greenmask_integer_transformer.go | 95.45% (**+95.45%**) | 44 (+44) | 42 (+42) | 2 (+2) | :star2: |
| 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_integer_transformer_test.go

</details>


Patch:
diff --git a/pkg/transformers/builder/transformer_builder.go b/pkg/transformers/builder/transformer_builder.go
index f3f4166..9ebd52a 100644
--- a/pkg/transformers/builder/transformer_builder.go
+++ b/pkg/transformers/builder/transformer_builder.go
@@ -20,6 +20,8 @@ func New(cfg *transformers.Config) (transformers.Transformer, error) {
 		return neosync.NewFirstNameTransformer(cfg.Parameters)
 	case transformers.GreenmaskFirstName:
 		return greenmask.NewFirstNameTransformer(cfg.Generator, cfg.Parameters)
+	case transformers.GreenmaskInteger:
+		return greenmask.NewIntegerTransformer(cfg.Generator, cfg.Parameters)
 	default:
 		return nil, transformers.ErrUnsupportedTransformer
 	}
diff --git a/pkg/transformers/greenmask/greenmask_integer_transformer.go b/pkg/transformers/greenmask/greenmask_integer_transformer.go
new file mode 100644
index 0000000..c834220
--- /dev/null
+++ b/pkg/transformers/greenmask/greenmask_integer_transformer.go
@@ -0,0 +1,118 @@
+// SPDX-License-Identifier: Apache-2.0
+
+package greenmask
+
+import (
+	"errors"
+	"fmt"
+	"math"
+
+	"github.com/eminano/greenmask/pkg/generators"
+	greenmasktransformers "github.com/eminano/greenmask/pkg/generators/transformers"
+	"github.com/xataio/pgstream/pkg/transformers"
+)
+
+const (
+	defaultSize = 4
+)
+
+type IntegerTransformer struct {
+	transformer *greenmasktransformers.RandomInt64Transformer
+}
+
+var errUnsupportedSizeError = errors.New("greenmask_integer: size must be 2, 4 or 8")
+
+// NewIntegerTransformer creates a new IntegerTransformer with the specified generator and parameters.
+// The size parameter must be 2, 4 or 8, and the min_value and max_value parameters
+// must be valid integers within the range of the specified size.
+func NewIntegerTransformer(generator transformers.GeneratorType, params transformers.Parameters) (*IntegerTransformer, error) {
+	size, err := findParameter(params, "size", int(defaultSize))
+	if err != nil {
+		return nil, fmt.Errorf("greenmask_integer: size must be an integer: %w", err)
+	}
+
+	defaultMinValue, defaultMaxValue, err := minMaxValueForSize(size)
+	if err != nil {
+		return nil, err
+	}
+
+	minValue, err := findParameter(params, "min_value", defaultMinValue)
+	if err != nil {
+		return nil, fmt.Errorf("greenmask_integer: min_value must be an integer: %w", err)
+	}
+	maxValue, err := findParameter(params, "max_value", defaultMaxValue)
+	if err != nil {
+		return nil, fmt.Errorf("greenmask_integer: max_value must be an integer: %w", err)
+	}
+	limiter, err := greenmasktransformers.NewInt64Limiter(minValue, maxValue)
+	if err != nil {
+		return nil, err
+	}
+
+	t, err := greenmasktransformers.NewRandomInt64Transformer(limiter, size)
+	if err != nil {
+		return nil, err
+	}
+
+	if err := setGenerator(t, generator); err != nil {
+		return nil, err
+	}
+
+	return &IntegerTransformer{
+		transformer: t,
+	}, nil
+}
+
+// Transform converts the input value to a byte slice, passes it through the underlying
+// RandomInt64Transformer, and returns the transformed value as an int64.
+// Supported input types are int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, and byte.
+// If the input value is a byte slice, it is passed through the transformer without modification.
+// If the input value is of an unsupported type, an error is returned.
+func (t *IntegerTransformer) Transform(value any) (any, error) {
+	var toTransform []byte
+	switch val := value.(type) {
+	case int:
+		toTransform = generators.BuildBytesFromUint64(uint64(val))
+	case int8:
+		toTransform = generators.BuildBytesFromUint64(uint64(val))
+	case int16:
+		toTransform = generators.BuildBytesFromUint64(uint64(val))
+	case int32:
+		toTransform = generators.BuildBytesFromUint64(uint64(val))
+	case int64:
+		toTransform = generators.BuildBytesFromUint64(uint64(val))
+	case uint:
+		toTransform = generators.BuildBytesFromUint64(uint64(val))
+	case uint8:
+		toTransform = generators.BuildBytesFromUint64(uint64(val))
+	case uint16:
+		toTransform = generators.BuildBytesFromUint64(uint64(val))
+	case uint32:
+		toTransform = generators.BuildBytesFromUint64(uint64(val))
+	case uint64:
+		toTransform = generators.BuildBytesFromUint64(uint64(val))
+	case []byte:
+		toTransform = val
+	default:
+		return nil, transformers.ErrUnsupportedValueType
+	}
+
+	ret, err := t.transformer.Transform(nil, toTransform)
+	if err != nil {
+		return nil, err
+	}
+
+	return int64(ret), nil
+}
+
+func minMaxValueForSize(size int) (int64, int64, error) {
+	switch size {
+	case 2:
+		return math.MinInt16, math.MaxInt16, nil
+	case 4:
+		return math.MinInt32, math.MaxInt32, nil
+	case 8:
+		return math.MinInt64, math.MaxInt64, nil
+	}
+	return 0, 0, errUnsupportedSizeError
+}
diff --git a/pkg/transformers/transformer.go b/pkg/transformers/transformer.go
index adf5471..398a3cf 100644
--- a/pkg/transformers/transformer.go
+++ b/pkg/transformers/transformer.go
@@ -24,6 +24,7 @@ const (
 	GreenmaskString    TransformerType = "greenmask_string"
 	NeosyncFirstName   TransformerType = "neosync_firstname"
 	GreenmaskFirstName TransformerType = "greenmask_firstname"
+	GreenmaskInteger   TransformerType = "greenmask_integer"
 )
 
 type GeneratorType string


Test patch:
diff --git a/pkg/transformers/greenmask/greenmask_integer_transformer_test.go b/pkg/transformers/greenmask/greenmask_integer_transformer_test.go
new file mode 100644
index 0000000..caa9dc4
--- /dev/null
+++ b/pkg/transformers/greenmask/greenmask_integer_transformer_test.go
@@ -0,0 +1,280 @@
+// SPDX-License-Identifier: Apache-2.0
+
+package greenmask
+
+import (
+	"math"
+	"testing"
+
+	greenmasktransformers "github.com/eminano/greenmask/pkg/generators/transformers"
+	"github.com/stretchr/testify/require"
+	"github.com/xataio/pgstream/pkg/transformers"
+)
+
+func TestNewIntegerTransformer(t *testing.T) {
+	t.Parallel()
+	tests := []struct {
+		name      string
+		generator transformers.GeneratorType
+		params    transformers.Parameters
+		wantErr   error
+	}{
+		{
+			name:      "ok - valid default parameters",
+			generator: transformers.Random,
+			params:    transformers.Parameters{},
+			wantErr:   nil,
+		},
+		{
+			name:      "ok - valid custom parameters",
+			generator: transformers.Deterministic,
+			params: transformers.Parameters{
+				"size":      4,
+				"min_value": int64(-100),
+				"max_value": int64(100),
+			},
+			wantErr: nil,
+		},
+		{
+			name:      "error - invalid generator type",
+			generator: "invalid",
+			wantErr:   transformers.ErrUnsupportedGenerator,
+		},
+		{
+			name:      "error - invalid size, too small",
+			generator: transformers.Random,
+			params: transformers.Parameters{
+				"size": 0,
+			},
+			wantErr: errUnsupportedSizeError,
+		},
+		{
+			name:      "error - invalid size, too large",
+			generator: transformers.Deterministic,
+			params: transformers.Parameters{
+				"size": 9,
+			},
+			wantErr: errUnsupportedSizeError,
+		},
+		{
+			name:      "error - wrong limits",
+			generator: transformers.Random,
+			params: transformers.Parameters{
+				"min_value": int64(100),
+				"max_value": int64(99),
+			},
+			wantErr: greenmasktransformers.ErrWrongLimits,
+		},
+		{
+			name:      "error - wrong limits not fitting size",
+			generator: transformers.Random,
+			params: transformers.Parameters{
+				"min_value": int64(math.MaxInt32),
+				"size":      4,
+			},
+			wantErr: greenmasktransformers.ErrWrongLimits,
+		},
+		{
+			name:      "error - invalid size type",
+			generator: transformers.Deterministic,
+			params: transformers.Parameters{
+				"size": "invalid",
+			},
+			wantErr: transformers.ErrInvalidParameters,
+		},
+		{
+			name:      "error - invalid min_value type",
+			generator: transformers.Random,
+			params: transformers.Parameters{
+				"min_value": "invalid",
+			},
+			wantErr: transformers.ErrInvalidParameters,
+		},
+		{
+			name:      "error - invalid max_value type",
+			generator: transformers.Deterministic,
+			params: transformers.Parameters{
+				"max_value": "invalid",
+			},
+			wantErr: transformers.ErrInvalidParameters,
+		},
+	}
+
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			t.Parallel()
+			transformer, err := NewIntegerTransformer(tt.generator, tt.params)
+			require.ErrorIs(t, err, tt.wantErr)
+			if err != nil {
+				return
+			}
+
+			require.NotNil(t, transformer)
+		})
+	}
+}
+
+func TestIntegerTransformer_Transform(t *testing.T) {
+	t.Parallel()
+	tests := []struct {
+		name          string
+		generatorType transformers.GeneratorType
+		input         any
+		params        transformers.Parameters
+
+		wantErr error
+	}{
+		{
+			name:          "ok - transform int8 randomly",
+			generatorType: transformers.Random,
+			input:         int8(120),
+			params: map[string]any{
+				"size":      8,
+				"min_value": int64(-100),
+				"max_value": int64(100),
+			},
+		},
+		{
+			name:          "ok - transform uint8 randomly",
+			generatorType: transformers.Random,
+			input:         uint8(120),
+			params: map[string]any{
+				"size":      2,
+				"min_value": int64(-100),
+				"max_value": int64(100),
+			},
+		},
+		{
+			name:          "ok - transform []byte randomly",
+			generatorType: transformers.Random,
+			input:         []byte{0, 0, 0, 50},
+			params: map[string]any{
+				"size":      4,
+				"min_value": int64(-100),
+				"max_value": int64(500),
+			},
+		},
+		{
+			name:          "ok - transform int16 randomly",
+			generatorType: transformers.Random,
+			input:         int16(500),
+			params: map[string]any{
+				"size":      8,
+				"min_value": int64(-400),
+				"max_value": int64(100),
+			},
+		},
+		{
+			name:          "ok - transform int64 randomly with default params",
+			generatorType: transformers.Random,
+			input:         int64(500),
+		},
+		{
+			name:          "ok - transform int deterministically with default params",
+			generatorType: transformers.Deterministic,
+			input:         int(500),
+		},
+		{
+			name:          "ok - transform uint deterministically with default params",
+			generatorType: transformers.Deterministic,
+			input:         uint(4646),
+		},
+		{
+			name:          "ok - transform uint32 deterministically with default params",
+			generatorType: transformers.Deterministic,
+			input:         uint32(500000000),
+			params:        map[string]any{},
+		},
+		{
+			name:          "ok - transform int32 deterministically",
+			generatorType: transformers.Deterministic,
+			input:         int32(45000),
+			params: map[string]any{
+				"size":      2,
+				"min_value": int64(-100),
+			},
+		},
+		{
+			name:          "ok - transform uint16 deterministically",
+			generatorType: transformers.Deterministic,
+			input:         uint16(0),
+			params: map[string]any{
+				"size":      2,
+				"min_value": int64(-100),
+			},
+		},
+		{
+			name:          "ok - transform uint64 deterministically",
+			generatorType: transformers.Deterministic,
+			input:         uint64(1000000000000000000),
+			params: map[string]any{
+				"size":      8,
+				"min_value": int64(math.MaxInt64 - 1),
+			},
+		},
+		{
+			name:          "ok - transform []byte deterministically, oversize",
+			generatorType: transformers.Deterministic,
+			input:         []byte{0, 1, 2, 3, 0, 0, 50, 0, 0, 0},
+			params: map[string]any{
+				"size":      2,
+				"min_value": int64(-100),
+			},
+		},
+		{
+			name:          "invalid type with default params",
+			generatorType: transformers.Deterministic,
+			input:         "invalid",
+			params:        map[string]any{},
+			wantErr:       transformers.ErrUnsupportedValueType,
+		},
+		{
+			name:          "invalid type",
+			generatorType: transformers.Random,
+			input:         "invalid",
+			params: map[string]any{
+				"size":      8,
+				"min_value": int64(-100),
+				"max_value": int64(100),
+			},
+			wantErr: transformers.ErrUnsupportedValueType,
+		},
+	}
+
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			t.Parallel()
+			transformer, err := NewIntegerTransformer(tt.generatorType, tt.params)
+			require.NoError(t, err)
+
+			got, err := transformer.Transform(tt.input)
+			require.ErrorIs(t, err, tt.wantErr)
+			if err != nil {
+				return
+			}
+
+			result, ok := got.(int64)
+			require.True(t, ok, "expected got to be of type int64")
+
+			// check if the result is within the specified range
+			minVal, found, err := transformers.FindParameter[int64](tt.params, "min_value")
+			require.NoError(t, err)
+			if found {
+				require.True(t, result >= minVal)
+			}
+
+			maxVal, found, err := transformers.FindParameter[int64](tt.params, "max_value")
+			require.NoError(t, err)
+			if found {
+				require.True(t, result <= maxVal)
+			}
+
+			// if deterministic, check if we get the same result again
+			if tt.generatorType == transformers.Deterministic {
+				gotAgain, err := transformer.Transform(tt.input)
+				require.NoError(t, err)
+				require.Equal(t, got, gotAgain)
+			}
+		})
+	}
+}