From 8b8a0a711def5e68d2949945bf5715065c00f075 Mon Sep 17 00:00:00 2001 From: Vadim Voitenko Date: Thu, 16 May 2024 11:10:24 +0300 Subject: [PATCH] fix: renamed precision parameter to decimal in docs --- config.yml.example | 2 +- .../custom_functions/core_functions.md | 16 ++++++++-------- .../standard_transformers/noise_float.md | 6 +++--- .../standard_transformers/random_float.md | 17 +++++++++-------- docs/commands.md | 4 ++-- 5 files changed, 23 insertions(+), 22 deletions(-) diff --git a/config.yml.example b/config.yml.example index 5540208e..d8a43327 100644 --- a/config.yml.example +++ b/config.yml.example @@ -155,7 +155,7 @@ dump: params: ratio: 0.1 column: "test_float" - precision: 2 + decimal: 2 restore: pg_restore_options: diff --git a/docs/built_in_transformers/advanced_transformers/custom_functions/core_functions.md b/docs/built_in_transformers/advanced_transformers/custom_functions/core_functions.md index e470d482..221ccdd7 100644 --- a/docs/built_in_transformers/advanced_transformers/custom_functions/core_functions.md +++ b/docs/built_in_transformers/advanced_transformers/custom_functions/core_functions.md @@ -113,16 +113,16 @@ Adds or subtracts a random duration in the provided `interval` to or from the or ### noiseFloat -Adds or subtracts a random fraction to or from the original float value. Multiplies the original float value by a provided random value that is not higher than the `ratio` parameter and adds it to the original value with the option to specify the precision via the `precision` parameter. +Adds or subtracts a random fraction to or from the original float value. Multiplies the original float value by a provided random value that is not higher than the `ratio` parameter and adds it to the original value with the option to specify the decimal via the `decimal` parameter. === "Signature" - `noiseFloat(ratio float, precision int, value float) (res float64, err error)` + `noiseFloat(ratio float, decimal int, value float) (res float64, err error)` === "Parameters" * `ratio` — the maximum multiplier value in the interval (0:1). The value will be randomly generated up to `ratio`, multiplied by the original value, and the result will be added to the original value. - * `precision` — the precision of the resulted value + * `decimal` — the decimal of the resulted value * `value` — the original value === "Return values" @@ -176,13 +176,13 @@ Generates a random float value within the provided interval. === "Signature" - `randomFloat(min any, max any, precision int) (res float, err error)` + `randomFloat(min any, max any, decimal int) (res float, err error)` === "Parameters" * `min` — the minimum random value threshold * `max` — the maximum random value threshold - * `precision` — the precision of the resulted value + * `decimal` — the decimal of the resulted value === "Return values" @@ -229,15 +229,15 @@ Generates a random string using the provided characters within the specified len ### roundFloat -Rounds a float value up to provided precision. +Rounds a float value up to provided decimal. === "Signature" - `roundFloat(precision int, original float) (res float, err error)` + `roundFloat(decimal int, original float) (res float, err error)` === "Parameters" - * `precision` — the precision of the value + * `decimal` — the decimal of the value * `original` — the original float value === "Return values" diff --git a/docs/built_in_transformers/standard_transformers/noise_float.md b/docs/built_in_transformers/standard_transformers/noise_float.md index 8c3ff1f0..18fa2c10 100644 --- a/docs/built_in_transformers/standard_transformers/noise_float.md +++ b/docs/built_in_transformers/standard_transformers/noise_float.md @@ -5,7 +5,7 @@ Add or subtract a random fraction to the original float value. | Name | Description | Default | Required | Supported DB types | |-----------|---------------------------------------------------------------------------------------------------|----------|----------|--------------------| | column | The name of the column to be affected | | Yes | float4, float8 | -| precision | The precision of the noised float value (number of digits after the decimal point) | `4` | No | - | +| decimal | The decimal of the noised float value (number of digits after the decimal point) | `4` | No | - | | min_ratio | The minimum random percentage for noise, from `0` to `1`, e. g. `0.1` means "add noise up to 10%" | `0.05` | No | - | | max_ratio | The maximum random percentage for noise, from `0` to `1`, e. g. `0.1` means "add noise up to 10%" | | Yes | - | | min | Min threshold of noised value | | No | - | @@ -23,7 +23,7 @@ Add or subtract a random fraction to the original float value. The `NoiseFloat` transformer multiplies the original float value by randomly generated value that is not higher than the `max_ratio` parameter and not less that `max_ratio` parameter and adds it to or subtracts it from the original -value. Additionally, you can specify the number of decimal digits by using the `precision` parameter. +value. Additionally, you can specify the number of decimal digits by using the `decimal` parameter. In case you have constraints on the float range, you can set the `min` and `max` parameters to specify the threshold values. The values for `min` and `max` must have the same format as the `column` parameter. Parameters min and max @@ -53,7 +53,7 @@ In this example, the original value of `standardprice` will be noised up to `50% params: column: "lastreceiptcost" max_ratio: 0.15 - precision: 2 + decimal: 2 dynamic_params: min: column: "standardprice" diff --git a/docs/built_in_transformers/standard_transformers/random_float.md b/docs/built_in_transformers/standard_transformers/random_float.md index c0db5b70..8dc7d4e5 100644 --- a/docs/built_in_transformers/standard_transformers/random_float.md +++ b/docs/built_in_transformers/standard_transformers/random_float.md @@ -2,23 +2,24 @@ Generate a random float within the provided interval. ## Parameters -| Name | Description | Default | Required | Supported DB types | -|-----------|----------------------------------------------------------------------------------------|---------|----------|---------------------------------------------------| -| column | The name of the column to be affected | | Yes | float4 (real), float8 (double precision), numeric | +| Name | Description | Default | Required | Supported DB types | +|-----------|-----------------------------------------------------------------------------------------|---------|----------|---------------------------------------------------| +| column | The name of the column to be affected | | Yes | float4 (real), float8 (double precision), numeric | | min | The minimum threshold for the random value. The value range depends on the column type. | | Yes | - | | max | The maximum threshold for the random value. The value range depends on the column type. | | Yes | - | -| precision | The precision of the random float value (number of digits after the decimal point) | `4` | No | - | -| keep_null | Indicates whether NULL values should be replaced with transformed values or not | `true` | No | - | +| decimal | The decimal of the random float value (number of digits after the decimal point) | `4` | No | - | +| keep_null | Indicates whether NULL values should be replaced with transformed values or not | `true` | No | - | ## Description The `RandomFloat` transformer generates a random float value within the provided interval, starting from `min` to -`max`, with the option to specify the number of decimal digits by using the `precision` parameter. The behaviour for NULL values can be configured using the `keep_null` parameter. +`max`, with the option to specify the number of decimal digits by using the `decimal` parameter. The behaviour for +NULL values can be configured using the `keep_null` parameter. ## Example: Generate random price In this example, the `RandomFloat` transformer generates random prices in the range from `0.1` to `7000` while -maintaining a precision of up to 2 digits. +maintaining a decimal of up to 2 digits. ``` yaml title="RandomFloat transformer example" - schema: "sales" @@ -29,7 +30,7 @@ maintaining a precision of up to 2 digits. column: "unitprice" min: 0.1 max: 7000 - precision: 2 + decimal: 2 ``` ```bash title="Expected result" diff --git a/docs/commands.md b/docs/commands.md index da36df33..e16e6ab7 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,