Repository: GreenmaskIO/greenmask
Pull request #121 (2024-05-16 10:58:53)

fix: transformers precision parameter to decimal
The `precision` parameter has been renamed to `decimal`. Because `precision` is not the right term for describing a fractional pared of a digit.

Affected transformers:
* RandomFloat
* NoiseFloat
* RandomNumeric
* NoiseNumeric


Patch:
diff --git a/docs/commands.md b/docs/commands.md
index da36df3..e16e6ab 100644
--- a/docs/commands.md
+++ b/docs/commands.md
@@ -522,8 +522,8 @@ their possible attributes. Below are the key parameters for each transformer:
         "default_value": "MC4x"
       },
       {
-        "name": "precision",
-        "description": "precision of noised float value (number of digits after coma)",
+        "name": "decimal",
+        "description": "decimal of noised float value (number of digits after coma)",
         "required": false,
         "is_column": false,
         "is_column_container": false,
diff --git a/internal/db/postgres/transformers/noise_float.go b/internal/db/postgres/transformers/noise_float.go
index 29bc486..3466514 100644
--- a/internal/db/postgres/transformers/noise_float.go
+++ b/internal/db/postgres/transformers/noise_float.go
@@ -41,8 +41,8 @@ var NoiseFloatTransformerDefinition = utils.NewTransformerDefinition(
 	).SetRequired(true),
 
 	toolkit.MustNewParameterDefinition(
-		"precision",
-		"precision of noised float value (number of digits after coma)",
+		"decimal",
+		"Numbers of decimal",
 	).SetDefaultValue(toolkit.ParamsValue("4")),
 
 	toolkit.MustNewParameterDefinition(
@@ -74,18 +74,18 @@ type NoiseFloatTransformer struct {
 	t               *transformers.NoiseFloat64Transformer
 	columnName      string
 	columnIdx       int
-	precision       int
+	decimal         int
 	affectedColumns map[int]string
 	dynamicMode     bool
 	floatSize       int
 
-	columnParam    toolkit.Parameterizer
-	maxParam       toolkit.Parameterizer
-	minParam       toolkit.Parameterizer
-	engineParam    toolkit.Parameterizer
-	precisionParam toolkit.Parameterizer
-	maxRatioParam  toolkit.Parameterizer
-	minRatioParam  toolkit.Parameterizer
+	columnParam   toolkit.Parameterizer
+	maxParam      toolkit.Parameterizer
+	minParam      toolkit.Parameterizer
+	engineParam   toolkit.Parameterizer
+	decimalParam  toolkit.Parameterizer
+	maxRatioParam toolkit.Parameterizer
+	minRatioParam toolkit.Parameterizer
 
 	transform func(context.Context, float64) (float64, error)
 }
@@ -95,7 +95,7 @@ func NewNoiseFloatTransformer(ctx context.Context, driver *toolkit.Driver, param
 	var columnName, engine string
 	var dynamicMode bool
 	var minValueThreshold, maxValueThreshold, minRatio, maxRatio float64
-	var precision int
+	var decimal int
 
 	columnParam := parameters["column"]
 	minParam := parameters["min"]
@@ -103,7 +103,7 @@ func NewNoiseFloatTransformer(ctx context.Context, driver *toolkit.Driver, param
 	maxRatioParam := parameters["max_ratio"]
 	minRatioParam := parameters["min_ratio"]
 	engineParam := parameters["engine"]
-	precisionParam := parameters["precision"]
+	decimalParam := parameters["decimal"]
 
 	if err := engineParam.Scan(&engine); err != nil {
 		return nil, nil, fmt.Errorf(`unable to scan "engine" param: %w`, err)
@@ -134,8 +134,8 @@ func NewNoiseFloatTransformer(ctx context.Context, driver *toolkit.Driver, param
 		}
 	}
 
-	if err := precisionParam.Scan(&precision); err != nil {
-		return nil, nil, fmt.Errorf(`unable to scan "precision" param: %w`, err)
+	if err := decimalParam.Scan(&decimal); err != nil {
+		return nil, nil, fmt.Errorf(`unable to scan "decimal" param: %w`, err)
 	}
 
 	if err := minRatioParam.Scan(&minRatio); err != nil {
@@ -146,7 +146,7 @@ func NewNoiseFloatTransformer(ctx context.Context, driver *toolkit.Driver, param
 		return nil, nil, fmt.Errorf("unable to scan \"max_ratio\" param: %w", err)
 	}
 
-	limiter, limitsWarnings, err := validateNoiseFloatTypeAndSetLimit(floatSize, minValueThreshold, maxValueThreshold, precision)
+	limiter, limitsWarnings, err := validateNoiseFloatTypeAndSetLimit(floatSize, minValueThreshold, maxValueThreshold, decimal)
 	if err != nil {
 		return nil, nil, err
 	}
@@ -169,13 +169,13 @@ func NewNoiseFloatTransformer(ctx context.Context, driver *toolkit.Driver, param
 		columnName:      columnName,
 		affectedColumns: affectedColumns,
 		columnIdx:       idx,
-		precision:       precision,
+		decimal:         decimal,
 
-		columnParam:    columnParam,
-		minParam:       minParam,
-		maxParam:       maxParam,
-		engineParam:    engineParam,
-		precisionParam: precisionParam,
+		columnParam:  columnParam,
+		minParam:     minParam,
+		maxParam:     maxParam,
+		engineParam:  engineParam,
+		decimalParam: decimalParam,
 
 		dynamicMode: dynamicMode,
 		floatSize:   floatSize,
@@ -207,7 +207,7 @@ func (nft *NoiseFloatTransformer) dynamicTransform(ctx context.Context, v float6
 		return 0, fmt.Errorf("unable to get min and max values: %w", err)
 	}
 
-	limiter, err := transformers.NewNoiseFloat64Limiter(minVal, maxVal, nft.precision)
+	limiter, err := transformers.NewNoiseFloat64Limiter(minVal, maxVal, nft.decimal)
 	if err != nil {
 		return 0, fmt.Errorf("error creating limiter in dynamic mode: %w", err)
 	}
@@ -241,7 +241,7 @@ func (nft *NoiseFloatTransformer) Transform(ctx context.Context, r *toolkit.Reco
 }
 
 func validateNoiseFloatTypeAndSetLimit(
-	size int, requestedMinValue, requestedMaxValue float64, precision int,
+	size int, requestedMinValue, requestedMaxValue float64, decimal int,
 ) (limiter *transformers.NoiseFloat64Limiter, warns toolkit.ValidationWarnings, err error) {
 
 	minValue, maxValue, err := getFloatThresholds(size)
@@ -275,13 +275,13 @@ func validateNoiseFloatTypeAndSetLimit(
 		return nil, warns, nil
 	}
 
-	limiter, err = transformers.NewNoiseFloat64Limiter(-math.MaxFloat64, math.MaxFloat64, precision)
+	limiter, err = transformers.NewNoiseFloat64Limiter(-math.MaxFloat64, math.MaxFloat64, decimal)
 	if err != nil {
 		return nil, nil, err
 	}
 
 	if requestedMinValue != 0 || requestedMaxValue != 0 {
-		limiter, err = transformers.NewNoiseFloat64Limiter(requestedMinValue, requestedMaxValue, precision)
+		limiter, err = transformers.NewNoiseFloat64Limiter(requestedMinValue, requestedMaxValue, decimal)
 		if err != nil {
 			return nil, nil, err
 		}
diff --git a/internal/db/postgres/transformers/noise_numeric.go b/internal/db/postgres/transformers/noise_numeric.go
index 106f3dd..1446b14 100644
--- a/internal/db/postgres/transformers/noise_numeric.go
+++ b/internal/db/postgres/transformers/noise_numeric.go
@@ -41,8 +41,8 @@ var NoiseNumericTransformerDefinition = utils.NewTransformerDefinition(
 	).SetRequired(true),
 
 	toolkit.MustNewParameterDefinition(
-		"precision",
-		"precision of noised float value (number of digits after coma)",
+		"decimal",
+		"Numbers of decimal",
 	).SetDefaultValue(toolkit.ParamsValue("4")),
 
 	toolkit.MustNewParameterDefinition(
@@ -91,7 +91,7 @@ type NoiseNumericTransformer struct {
 	t               *transformers.NoiseNumericTransformer
 	columnName      string
 	columnIdx       int
-	precision       int32
+	decimal         int32
 	affectedColumns map[int]string
 	dynamicMode     bool
 
@@ -99,13 +99,13 @@ type NoiseNumericTransformer struct {
 	maxAllowedValue decimal.Decimal
 	numericSize     int
 
-	columnParam    toolkit.Parameterizer
-	maxParam       toolkit.Parameterizer
-	minParam       toolkit.Parameterizer
-	engineParam    toolkit.Parameterizer
-	precisionParam toolkit.Parameterizer
-	maxRatioParam  toolkit.Parameterizer
-	minRatioParam  toolkit.Parameterizer
+	columnParam   toolkit.Parameterizer
+	maxParam      toolkit.Parameterizer
+	minParam      toolkit.Parameterizer
+	engineParam   toolkit.Parameterizer
+	decimalParam  toolkit.Parameterizer
+	maxRatioParam toolkit.Parameterizer
+	minRatioParam toolkit.Parameterizer
 
 	transform func(decimal.Decimal) (decimal.Decimal, error)
 }
@@ -124,7 +124,7 @@ func NewNumericFloatTransformer(ctx context.Context, driver *toolkit.Driver, par
 	maxRatioParam := parameters["max_ratio"]
 	minRatioParam := parameters["min_ratio"]
 	engineParam := parameters["engine"]
-	precisionParam := parameters["precision"]
+	decimalParam := parameters["decimal"]
 
 	if err := engineParam.Scan(&engine); err != nil {
 		return nil, nil, fmt.Errorf(`unable to scan "engine" param: %w`, err)
@@ -154,8 +154,8 @@ func NewNumericFloatTransformer(ctx context.Context, driver *toolkit.Driver, par
 		}
 	}
 
-	if err := precisionParam.Scan(&precision); err != nil {
-		return nil, nil, fmt.Errorf(`unable to scan "precision" param: %w`, err)
+	if err := decimalParam.Scan(&precision); err != nil {
+		return nil, nil, fmt.Errorf(`unable to scan "decimal" param: %w`, err)
 	}
 
 	if err := minRatioParam.Scan(&minRatio); err != nil {
@@ -190,13 +190,13 @@ func NewNumericFloatTransformer(ctx context.Context, driver *toolkit.Driver, par
 		columnName:      columnName,
 		affectedColumns: affectedColumns,
 		columnIdx:       idx,
-		precision:       precision,
+		decimal:         precision,
 
-		columnParam:    columnParam,
-		minParam:       minParam,
-		maxParam:       maxParam,
-		engineParam:    engineParam,
-		precisionParam: precisionParam,
+		columnParam:  columnParam,
+		minParam:     minParam,
+		maxParam:     maxParam,
+		engineParam:  engineParam,
+		decimalParam: decimalParam,
 
 		minAllowedValue: limiter.MinValue,
 		maxAllowedValue: limiter.MaxValue,
@@ -240,7 +240,7 @@ func (nft *NoiseNumericTransformer) dynamicTransform(original decimal.Decimal) (
 	if err != nil {
 		return decimal.Decimal{}, fmt.Errorf("error creating limiter in dynamic mode: %w", err)
 	}
-	limiter.SetPrecision(nft.precision)
+	limiter.SetPrecision(nft.decimal)
 	return nft.t.SetDynamicLimiter(limiter).Transform(original)
 }
 
diff --git a/internal/db/postgres/transformers/random_float.go b/internal/db/postgres/transformers/random_float.go
index 666594a..e88f1a8 100644
--- a/internal/db/postgres/transformers/random_float.go
+++ b/internal/db/postgres/transformers/random_float.go
@@ -67,8 +67,8 @@ var floatTransformerDefinition = utils.NewTransformerDefinition(
 		),
 
 	toolkit.MustNewParameterDefinition(
-		"precision",
-		"precision of float value (number of digits after coma)",
+		"decimal",
+		"Numbers of decimal",
 	).SetDefaultValue(toolkit.ParamsValue("4")),
 
 	keepNullParameterDefinition,
@@ -84,14 +84,14 @@ type FloatTransformer struct {
 	columnIdx       int
 	dynamicMode     bool
 	floatSize       int
-	precision       int
+	decimal         int
 
-	columnParam    toolkit.Parameterizer
-	maxParam       toolkit.Parameterizer
-	minParam       toolkit.Parameterizer
-	keepNullParam  toolkit.Parameterizer
-	engineParam    toolkit.Parameterizer
-	precisionParam toolkit.Parameterizer
+	columnParam   toolkit.Parameterizer
+	maxParam      toolkit.Parameterizer
+	minParam      toolkit.Parameterizer
+	keepNullParam toolkit.Parameterizer
+	engineParam   toolkit.Parameterizer
+	decimalParam  toolkit.Parameterizer
 
 	transform func(context.Context, []byte) (float64, error)
 }
@@ -101,14 +101,14 @@ func NewFloatTransformer(ctx context.Context, driver *toolkit.Driver, parameters
 	var columnName, engine string
 	var minVal, maxVal float64
 	var keepNull, dynamicMode bool
-	var precision int
+	var decimal int
 
 	columnParam := parameters["column"]
 	minParam := parameters["min"]
 	maxParam := parameters["max"]
 	keepNullParam := parameters["keep_null"]
 	engineParam := parameters["engine"]
-	precisionParam := parameters["precision"]
+	decimalParam := parameters["decimal"]
 
 	if err := engineParam.Scan(&engine); err != nil {
 		return nil, nil, fmt.Errorf(`unable to scan "engine" param: %w`, err)
@@ -143,11 +143,11 @@ func NewFloatTransformer(ctx context.Context, driver *toolkit.Driver, parameters
 		}
 	}
 
-	if err := precisionParam.Scan(&precision); err != nil {
-		return nil, nil, fmt.Errorf(`unable to scan "precision" param: %w`, err)
+	if err := decimalParam.Scan(&decimal); err != nil {
+		return nil, nil, fmt.Errorf(`unable to scan "decimal" param: %w`, err)
 	}
 
-	limiter, limitsWarnings, err := validateFloatTypeAndSetLimit(floatSize, minVal, maxVal, precision)
+	limiter, limitsWarnings, err := validateFloatTypeAndSetLimit(floatSize, minVal, maxVal, decimal)
 	if err != nil {
 		return nil, nil, err
 	}
@@ -171,14 +171,14 @@ func NewFloatTransformer(ctx context.Context, driver *toolkit.Driver, parameters
 		keepNull:        keepNull,
 		affectedColumns: affectedColumns,
 		columnIdx:       idx,
-		precision:       precision,
+		decimal:         decimal,
 
-		columnParam:    columnParam,
-		minParam:       minParam,
-		maxParam:       maxParam,
-		keepNullParam:  keepNullParam,
-		engineParam:    engineParam,
-		precisionParam: precisionParam,
+		columnParam:   columnParam,
+		minParam:      minParam,
+		maxParam:      maxParam,
+		keepNullParam: keepNullParam,
+		engineParam:   engineParam,
+		decimalParam:  decimalParam,
 
 		dynamicMode: dynamicMode,
 		floatSize:   floatSize,
@@ -215,7 +215,7 @@ func (rit *FloatTransformer) dynamicTransform(ctx context.Context, v []byte) (fl
 		return 0, fmt.Errorf(`unable to scan "max" param: %w`, err)
 	}
 
-	limiter, err := getFloat64LimiterForDynamicParameter(rit.floatSize, minVal, maxVal, rit.precision)
+	limiter, err := getFloat64LimiterForDynamicParameter(rit.floatSize, minVal, maxVal, rit.decimal)
 	if err != nil {
 		return 0, fmt.Errorf("error creating limiter in dynamic mode: %w", err)
 	}
@@ -258,7 +258,7 @@ func getFloatThresholds(size int) (float64, float64, error) {
 	return 0, 0, fmt.Errorf("unsupported float size %d", size)
 }
 
-func getFloat64LimiterForDynamicParameter(size int, requestedMinValue, requestedMaxValue float64, precision int) (*transformers.Float64Limiter, error) {
+func getFloat64LimiterForDynamicParameter(size int, requestedMinValue, requestedMaxValue float64, decimal int) (*transformers.Float64Limiter, error) {
 	minValue, maxValue, err := getFloatThresholds(size)
 	if err != nil {
 		return nil, err
@@ -272,13 +272,13 @@ func getFloat64LimiterForDynamicParameter(size int, requestedMinValue, requested
 		return nil, fmt.Errorf("requested dynamic parameter max value is out of range of float%d size", size)
 	}
 
-	limiter, err := transformers.NewFloat64Limiter(-math.MaxFloat64, math.MaxFloat64, precision)
+	limiter, err := transformers.NewFloat64Limiter(-math.MaxFloat64, math.MaxFloat64, decimal)
 	if err != nil {
 		return nil, err
 	}
 
 	if requestedMinValue != 0 || requestedMaxValue != 0 {
-		limiter, err = transformers.NewFloat64Limiter(requestedMinValue, requestedMaxValue, precision)
+		limiter, err = transformers.NewFloat64Limiter(requestedMinValue, requestedMaxValue, decimal)
 		if err != nil {
 			return nil, err
 		}
@@ -287,7 +287,7 @@ func getFloat64LimiterForDynamicParameter(size int, requestedMinValue, requested
 }
 
 func validateFloatTypeAndSetLimit(
-	size int, requestedMinValue, requestedMaxValue float64, precision int,
+	size int, requestedMinValue, requestedMaxValue float64, decimal int,
 ) (limiter *transformers.Float64Limiter, warns toolkit.ValidationWarnings, err error) {
 
 	minValue, maxValue, err := getFloatThresholds(size)
@@ -321,13 +321,13 @@ func validateFloatTypeAndSetLimit(
 		return nil, warns, nil
 	}
 
-	limiter, err = transformers.NewFloat64Limiter(-math.MaxFloat64, math.MaxFloat64, precision)
+	limiter, err = transformers.NewFloat64Limiter(-math.MaxFloat64, math.MaxFloat64, decimal)
 	if err != nil {
 		return nil, nil, err
 	}
 
 	if requestedMinValue != 0 || requestedMaxValue != 0 {
-		limiter, err = transformers.NewFloat64Limiter(requestedMinValue, requestedMaxValue, precision)
+		limiter, err = transformers.NewFloat64Limiter(requestedMinValue, requestedMaxValue, decimal)
 		if err != nil {
 			return nil, nil, err
 		}
diff --git a/internal/db/postgres/transformers/random_numeric.go b/internal/db/postgres/transformers/random_numeric.go
index ebae432..47f69bc 100644
--- a/internal/db/postgres/transformers/random_numeric.go
+++ b/internal/db/postgres/transformers/random_numeric.go
@@ -31,8 +31,8 @@ var numericTransformerDefinition = utils.NewTransformerDefinition(
 	).SetRequired(true),
 
 	toolkit.MustNewParameterDefinition(
-		"precision",
-		"the value precision",
+		"decimal",
+		"the value decimal",
 	).SetDefaultValue([]byte("0")),
 
 	toolkit.MustNewParameterDefinition(
@@ -112,14 +112,14 @@ func NewRandomNumericTransformer(ctx context.Context, driver *toolkit.Driver, pa
 	maxParam := parameters["max"]
 	keepNullParam := parameters["keep_null"]
 	engineParam := parameters["engine"]
-	precisionParam := parameters["precision"]
+	precisionParam := parameters["decimal"]
 
 	if err := engineParam.Scan(&engine); err != nil {
 		return nil, nil, fmt.Errorf(`unable to scan "engine" param: %w`, err)
 	}
 
 	if err := precisionParam.Scan(&precision); err != nil {
-		return nil, nil, fmt.Errorf(`unable to scan "precision" param: %w`, err)
+		return nil, nil, fmt.Errorf(`unable to scan "decimal" param: %w`, err)
 	}
 	if minParam.IsDynamic() || maxParam.IsDynamic() {
 		dynamicMode = true
diff --git a/pkg/toolkit/template_functions.go b/pkg/toolkit/template_functions.go
index 6cbf9f1..bc07376 100644
--- a/pkg/toolkit/template_functions.go
+++ b/pkg/toolkit/template_functions.go
@@ -112,8 +112,8 @@ func FuncMap() template.FuncMap {
 		//"noiseDate": func(interval int64, val time.Time) time.Time { // TODO: tests
 		//	return *(utils.NoiseDate(randGen, interval, &val))
 		//},
-		"noiseFloat": func(ratio any, precision int, value any) (float64, error) {
-			return noiseFloat(randGen, precision, ratio, value)
+		"noiseFloat": func(ratio any, decimal int, value any) (float64, error) {
+			return noiseFloat(randGen, decimal, ratio, value)
 		},
 		"noiseInt": func(ratio any, value any) (int64, error) { return noiseInt(randGen, ratio, value) },
 
@@ -411,9 +411,9 @@ func noiseDatePgInterval(typeMap *pgtype.Map, randGen *rand.Rand, interval strin
 	return *(NoiseDateV2(randGen, ratio, &val)), nil
 }
 
-func noiseFloat(randGen *rand.Rand, precision int, ratio any, value any) (float64, error) {
-	if precision < 0 {
-		return 0, fmt.Errorf("precision must be 0 or higher got %d", precision)
+func noiseFloat(randGen *rand.Rand, decimal int, ratio any, value any) (float64, error) {
+	if decimal < 0 {
+		return 0, fmt.Errorf("decimal must be 0 or higher got %d", decimal)
 	}
 
 	r, err := cast.ToFloat64E(ratio)
@@ -430,7 +430,7 @@ func noiseFloat(randGen *rand.Rand, precision int, ratio any, value any) (float6
 		return 0, fmt.Errorf("ratio must be in interval (0, 1] got %f", ratio)
 	}
 
-	return NoiseFloat(randGen, r, v, precision), nil
+	return NoiseFloat(randGen, r, v, decimal), nil
 }
 
 func noiseInt(randGen *rand.Rand, ratio any, value any) (int64, error) {
@@ -460,16 +460,16 @@ func randomDate(randGen *rand.Rand, min, max time.Time) (time.Time, error) {
 }
 
 // randomFloat - generate float randomly in the interval [min, max] with precision. By default precision is 4 digits
-func randomFloat(randGen *rand.Rand, min, max any, precision ...any) (float64, error) {
+func randomFloat(randGen *rand.Rand, min, max any, decimal ...any) (float64, error) {
 	var err error
 	var p = 4
-	if len(precision) > 0 {
-		p, err = cast.ToIntE(precision[0])
+	if len(decimal) > 0 {
+		p, err = cast.ToIntE(decimal[0])
 		if err != nil {
-			return 0, fmt.Errorf("error casting \"precision\" (%+v) to int: %w", precision[0], err)
+			return 0, fmt.Errorf("error casting \"decimal\" (%+v) to int: %w", decimal[0], err)
 		}
 		if p < 0 {
-			return 0, fmt.Errorf("precision must be 0 or higher got %d", p)
+			return 0, fmt.Errorf("decimal must be 0 or higher got %d", p)
 		}
 	}
 
@@ -533,10 +533,10 @@ func randomString(randGen *rand.Rand, minLength, maxLength any, symbols ...strin
 	return RandomString(randGen, minLengthInt, maxLengthInt, s, buf), nil
 }
 
-func roundFloat(precision any, value any) (float64, error) {
-	p, err := cast.ToIntE(precision)
+func roundFloat(decimal any, value any) (float64, error) {
+	p, err := cast.ToIntE(decimal)
 	if err != nil {
-		return 0, fmt.Errorf("error casting \"precision\" (%+v) to int: %w", precision, err)
+		return 0, fmt.Errorf("error casting \"precision\" (%+v) to int: %w", decimal, err)
 	}
 	if p < 0 {
 		return 0, fmt.Errorf("precision must be 0 or higher got %d", p)


Test patch:
diff --git a/internal/db/postgres/transformers/noise_float_test.go b/internal/db/postgres/transformers/noise_float_test.go
index 5091c87..443df76 100644
--- a/internal/db/postgres/transformers/noise_float_test.go
+++ b/internal/db/postgres/transformers/noise_float_test.go
@@ -66,29 +66,29 @@ func TestNoiseFloatTransformer_Transform(t *testing.T) {
 			params: map[string]toolkit.ParamsValue{
 				"min_ratio": toolkit.ParamsValue("0.2"),
 				"max_ratio": toolkit.ParamsValue("0.9"),
-				"precision": toolkit.ParamsValue("10"),
+				"decimal":   toolkit.ParamsValue("10"),
 			},
 			input:  "100",
 			result: result{min: 10, max: 190, regexp: `^-*\d+[.]*\d{0,10}$`},
 		},
 		{
-			name:       "float8 ranges 1 with precision",
+			name:       "float8 ranges 1 with decimal",
 			columnName: "col_float8",
 			params: map[string]toolkit.ParamsValue{
 				"min_ratio": toolkit.ParamsValue("0.2"),
 				"max_ratio": toolkit.ParamsValue("0.9"),
-				"precision": toolkit.ParamsValue("0"),
+				"decimal":   toolkit.ParamsValue("0"),
 			},
 			input:  "100",
 			result: result{min: 10, max: 190, regexp: `^-*\d+$`},
 		},
 		{
-			name:       "float8 ranges 1 with precision and hash engine",
+			name:       "float8 ranges 1 with decimal and hash engine",
 			columnName: "col_float8",
 			params: map[string]toolkit.ParamsValue{
 				"min_ratio": toolkit.ParamsValue("0.2"),
 				"max_ratio": toolkit.ParamsValue("0.9"),
-				"precision": toolkit.ParamsValue("0"),
+				"decimal":   toolkit.ParamsValue("0"),
 				"engine":    toolkit.ParamsValue("hash"),
 			},
 			input:  "100",
@@ -102,7 +102,7 @@ func TestNoiseFloatTransformer_Transform(t *testing.T) {
 				"max_ratio": toolkit.ParamsValue("0.9"),
 				"min":       toolkit.ParamsValue("90"),
 				"max":       toolkit.ParamsValue("110"),
-				"precision": toolkit.ParamsValue("0"),
+				"decimal":   toolkit.ParamsValue("0"),
 			},
 			input:  "100",
 			result: result{min: 90, max: 110, regexp: `^-*\d+$`},
diff --git a/internal/db/postgres/transformers/noise_numeric_test.go b/internal/db/postgres/transformers/noise_numeric_test.go
index f60ce67..86ba4ce 100644
--- a/internal/db/postgres/transformers/noise_numeric_test.go
+++ b/internal/db/postgres/transformers/noise_numeric_test.go
@@ -56,29 +56,29 @@ func TestNoiseNumericTransformer_Transform(t *testing.T) {
 			params: map[string]toolkit.ParamsValue{
 				"min_ratio": toolkit.ParamsValue("0.2"),
 				"max_ratio": toolkit.ParamsValue("0.9"),
-				"precision": toolkit.ParamsValue("10"),
+				"decimal":   toolkit.ParamsValue("10"),
 			},
 			input:  "100",
 			result: result{min: 10, max: 190, regexp: `^-*\d+[.]*\d{0,10}$`},
 		},
 		{
-			name:       "numeric ranges 1 with precision",
+			name:       "numeric ranges 1 with decimal",
 			columnName: "id_numeric",
 			params: map[string]toolkit.ParamsValue{
 				"min_ratio": toolkit.ParamsValue("0.2"),
 				"max_ratio": toolkit.ParamsValue("0.9"),
-				"precision": toolkit.ParamsValue("0"),
+				"decimal":   toolkit.ParamsValue("0"),
 			},
 			input:  "100",
 			result: result{min: 10, max: 190, regexp: `^-*\d+$`},
 		},
 		{
-			name:       "numeric ranges 1 with precision and hash engine",
+			name:       "numeric ranges 1 with decimal and hash engine",
 			columnName: "id_numeric",
 			params: map[string]toolkit.ParamsValue{
 				"min_ratio": toolkit.ParamsValue("0.2"),
 				"max_ratio": toolkit.ParamsValue("0.9"),
-				"precision": toolkit.ParamsValue("0"),
+				"decimal":   toolkit.ParamsValue("0"),
 				"engine":    toolkit.ParamsValue("hash"),
 			},
 			input:  "100.111",
@@ -92,7 +92,7 @@ func TestNoiseNumericTransformer_Transform(t *testing.T) {
 				"max_ratio": toolkit.ParamsValue("0.9"),
 				"min":       toolkit.ParamsValue("90"),
 				"max":       toolkit.ParamsValue("110"),
-				"precision": toolkit.ParamsValue("4"),
+				"decimal":   toolkit.ParamsValue("4"),
 			},
 			input:  "100",
 			result: result{min: 90, max: 110, regexp: `^-*\d+$`},
diff --git a/internal/db/postgres/transformers/random_float_test.go b/internal/db/postgres/transformers/random_float_test.go
index 2254bee..a519366 100644
--- a/internal/db/postgres/transformers/random_float_test.go
+++ b/internal/db/postgres/transformers/random_float_test.go
@@ -69,9 +69,9 @@ func TestRandomFloatTransformer_Transform(t *testing.T) {
 			columnName:    "col_float8",
 			originalValue: "1000.0",
 			params: map[string]toolkit.ParamsValue{
-				"min":       toolkit.ParamsValue("-100000"),
-				"max":       toolkit.ParamsValue("100000"),
-				"precision": toolkit.ParamsValue("10"),
+				"min":     toolkit.ParamsValue("-100000"),
+				"max":     toolkit.ParamsValue("100000"),
+				"decimal": toolkit.ParamsValue("10"),
 			},
 			result: result{
 				min: -100000,
@@ -79,13 +79,13 @@ func TestRandomFloatTransformer_Transform(t *testing.T) {
 			},
 		},
 		{
-			name:          "float8 ranges 1 with precision",
+			name:          "float8 ranges 1 with decimal",
 			columnName:    "col_float8",
 			originalValue: "1000.0",
 			params: map[string]toolkit.ParamsValue{
-				"min":       toolkit.ParamsValue("-100000"),
-				"max":       toolkit.ParamsValue("-1"),
-				"precision": toolkit.ParamsValue("0"),
+				"min":     toolkit.ParamsValue("-100000"),
+				"max":     toolkit.ParamsValue("-1"),
+				"decimal": toolkit.ParamsValue("0"),
 			},
 			result: result{
 				min: -100000,
@@ -99,7 +99,7 @@ func TestRandomFloatTransformer_Transform(t *testing.T) {
 			params: map[string]toolkit.ParamsValue{
 				"min":       toolkit.ParamsValue("-100000"),
 				"max":       toolkit.ParamsValue("-1"),
-				"precision": toolkit.ParamsValue("0"),
+				"decimal":   toolkit.ParamsValue("0"),
 				"keep_null": toolkit.ParamsValue("false"),
 			},
 			result: result{
@@ -114,7 +114,7 @@ func TestRandomFloatTransformer_Transform(t *testing.T) {
 			params: map[string]toolkit.ParamsValue{
 				"min":       toolkit.ParamsValue("-100000"),
 				"max":       toolkit.ParamsValue("-1"),
-				"precision": toolkit.ParamsValue("0"),
+				"decimal":   toolkit.ParamsValue("0"),
 				"keep_null": toolkit.ParamsValue("true"),
 			},
 			result: result{
@@ -126,7 +126,7 @@ func TestRandomFloatTransformer_Transform(t *testing.T) {
 		//	params: map[string]toolkit.ParamsValue{
 		//		"min":       toolkit.ParamsValue("-100000"),
 		//		"max":       toolkit.ParamsValue("10.1241"),
-		//		"precision": toolkit.ParamsValue("3"),
+		//		"decimal": toolkit.ParamsValue("3"),
 		//		"useType":   toolkit.ParamsValue("float4"),
 		//	},
 		//	result: result{
diff --git a/pkg/toolkit/template_functions_test.go b/pkg/toolkit/template_functions_test.go
index c872776..c2cee3a 100644
--- a/pkg/toolkit/template_functions_test.go
+++ b/pkg/toolkit/template_functions_test.go
@@ -824,7 +824,7 @@ func TestFuncMap_randomFloat(t *testing.T) {
 				Max:       9.1,
 				Precision: -4,
 			},
-			expectedErr: " precision must be 0 or higher got -4",
+			expectedErr: " decimal must be 0 or higher got -4",
 		},
 	}