@@ -158,8 +158,9 @@ Structure `models[*].columns[*].type_params` for data type `string`:
158158- `min_length` : Minimum string length. Default is `1`.
159159- `max_length` : Maximum string length. Default is `32`.
160160- `logical_type` : Logical type of string. Supported values: `first_name`, `last_name`, `phone`, `text`.
161- - `template` : Template for string generation. Symbol `A` - any uppercase letter, symbol `a` - any lowercase letter,
162- symbol `0` - any digit, symbol `#` - any character. Other characters remain as-is.
161+ - `template` : Jinja-like template for string generation. Allows you to use any fields of the generated model and
162+ specify the pattern of the string using the `pattern` function. Information about the filters and functions
163+ available in template strings is described at the end of this section.
163164- `locale` : Locale for generated strings. Supported values: `ru`, `en`. Default is `en`.
164165- `without_large_letters` : Flag indicating if uppercase letters should be excluded from the string.
165166- `without_small_letters` : Flag indicating if lowercase letters should be excluded from the string.
@@ -240,6 +241,18 @@ Structure of `output.params` for `tcs` format:
240241Similar to the structure for the `http` format,
241242except that the `format_template` field is immutable and always set to its default value.
242243
244+ Filters and functions used in template strings :
245+
246+ Template strings are implemented using the `pongo2` library, you can read
247+ all available filters and functions in the [pongo2](https://github.com/flosch/pongo2) repository.
248+
249+ In addition, `1` function has been added :
250+
251+ - pattern : allows you to create a string pattern using special characters.
252+ The `A` symbol is any capital letter, the `a` symbol is any small letter,
253+ symbol `0` is any digit, the `#` symbol is any character, and the other characters remain as they are.
254+ The function is available only in the `template` field of the `string` data type.
255+
243256# ### Examples of data generation configuration
244257
245258Example data model configuration :
@@ -305,9 +318,13 @@ models:
305318 - name: passport
306319 type: string
307320 type_params:
308- template: AA 00 000 000
321+ template: "{{ pattern(' AA 00 000 000') }}"
309322 distinct_percentage: 1
310323 ordered: true
324+ - name: email
325+ type: string
326+ type_params:
327+ template: "{{ first_name_en | lower }}.{{ id }}@example.com"
311328 - name: rating
312329 type: float
313330 type_params:
0 commit comments