@@ -154,8 +154,9 @@ Structure `models[*].columns[*].type_params` for data type `string`:
154
154
- `min_length` : Minimum string length. Default is `1`.
155
155
- `max_length` : Maximum string length. Default is `32`.
156
156
- `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.
159
160
- `locale` : Locale for generated strings. Supported values: `ru`, `en`. Default is `en`.
160
161
- `without_large_letters` : Flag indicating if uppercase letters should be excluded from the string.
161
162
- `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:
236
237
Similar to the structure for the `http` format,
237
238
except that the `format_template` field is immutable and always set to its default value.
238
239
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
+
239
252
# ### Examples of data generation configuration
240
253
241
254
Example data model configuration :
@@ -301,9 +314,13 @@ models:
301
314
- name: passport
302
315
type: string
303
316
type_params:
304
- template: AA 00 000 000
317
+ template: "{{ pattern(' AA 00 000 000') }}"
305
318
distinct_percentage: 1
306
319
ordered: true
320
+ - name: email
321
+ type: string
322
+ type_params:
323
+ template: "{{ first_name_en | lower }}.{{ id }}@example.com"
307
324
- name: rating
308
325
type: float
309
326
type_params:
0 commit comments