@@ -154,8 +154,9 @@ Structure `models[*].columns[*].type_params` for data type `string`:
154154- `min_length` : Minimum string length. Default is `1`.
155155- `max_length` : Maximum string length. Default is `32`.
156156- `logical_type` : Logical type of string. Supported values: `first_name`, `last_name`, `phone`, `text`.
157- - `template` : Template for string generation. Symbol `A` - any uppercase letter, symbol `a` - any lowercase letter,
158- symbol `0` - any digit, symbol `#` - any character. Other characters remain as-is.
157+ - `template` : Jinja-like template for string generation. Allows you to use any fields of the generated model and
158+ specify the pattern of the string using the `pattern` function. Information about the filters and functions
159+ available in template strings is described at the end of this section.
159160- `locale` : Locale for generated strings. Supported values: `ru`, `en`. Default is `en`.
160161- `without_large_letters` : Flag indicating if uppercase letters should be excluded from the string.
161162- `without_small_letters` : Flag indicating if lowercase letters should be excluded from the string.
@@ -236,6 +237,18 @@ Structure of `output.params` for `tcs` format:
236237Similar to the structure for the `http` format,
237238except that the `format_template` field is immutable and always set to its default value.
238239
240+ Filters and functions used in template strings :
241+
242+ Template strings are implemented using the `pongo2` library, you can read
243+ all available filters and functions in the [pongo2](https://github.com/flosch/pongo2) repository.
244+
245+ In addition, `1` function has been added :
246+
247+ - pattern : allows you to create a string pattern using special characters.
248+ The `A` symbol is any capital letter, the `a` symbol is any small letter,
249+ symbol `0` is any digit, the `#` symbol is any character, and the other characters remain as they are.
250+ The function is available only in the `template` field of the `string` data type.
251+
239252# ### Examples of data generation configuration
240253
241254Example data model configuration :
@@ -301,9 +314,13 @@ models:
301314 - name: passport
302315 type: string
303316 type_params:
304- template: AA 00 000 000
317+ template: "{{ pattern(' AA 00 000 000') }}"
305318 distinct_percentage: 1
306319 ordered: true
320+ - name: email
321+ type: string
322+ type_params:
323+ template: "{{ first_name_en | lower }}.{{ id }}@example.com"
307324 - name: rating
308325 type: float
309326 type_params:
0 commit comments