Skip to content

Commit 2935df0

Browse files
committed
Fixed usage
1 parent bb029d6 commit 2935df0

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

doc/en/usage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Structure `models[*].columns[*].type_params` for data type `string`:
160160
- `logical_type`: Logical type of string. Supported values: `first_name`, `last_name`, `phone`, `text`.
161161
- `template`: Template for string generation. Allows you to use the values of any columns of the generated model.
162162
Information about the functions available in template strings is described at the end of this section.
163-
Cannot coexist with `ordered`, `distinct_percentage` or `distinct_count`.
163+
Cannot coexist with `ordered`, `distinct_percentage` and `distinct_count`.
164164
- `pattern`: Pattern for string generation. The `A` symbol is any capital letter, the `a` symbol is any small letter,
165165
symbol `0` is any digit, the `#` symbol is any character, and the other characters remain as they are.
166166
- `locale`: Locale for generated strings. Supported values: `ru`, `en`. Default is `en`.
@@ -240,7 +240,7 @@ Structure of `output.params` for `tcs` format:
240240
Similar to the structure for the `http` format,
241241
except that the `format_template` field is immutable and always set to its default value.
242242

243-
Using Template Strings::
243+
Using Template Strings:
244244

245245
Template strings are implemented using the standard golang library, you can read about
246246
all its features and available functions in this [documentation](https://pkg.go.dev/text/template).

doc/ru/usage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ open_ai:
166166
- `logical_type`: Логический тип строки. Поддерживаемые значения: `first_name`, `last_name`, `phone`, `text`.
167167
- `template`: Шаблон для генерации строки. Позволяет использовать значения любых столбов генерируемой модели.
168168
Информация о том, как использовать шаблонные строки, описана в конце данного раздела.
169-
Не работает совместно с `ordered`, `distinct_percentage` или `distinct_count`.
169+
Не работает совместно с `ordered`, `distinct_percentage` и `distinct_count`.
170170
- `pattern`: Паттерн для генерации строки. Символ `A` - любая большая буква, символ `a` - любая маленькая буква,
171171
символ `0` - любая цифра, символ `#` - любой символ, а остальные символы остаются как есть.
172172
- `locale`: Локаль для генерации строк. Поддерживаемые значения: `ru`, `en`. По умолчанию `en`.

internal/generator/models/generator_model.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -427,12 +427,12 @@ func (p *Params) Validate() []error {
427427
}
428428

429429
if p.StringParams != nil && p.StringParams.Template != "" {
430-
if common.Any(
431-
p.Ordered,
432-
p.DistinctPercentage != 0,
433-
p.DistinctCount != 0,
434-
) {
435-
errs = append(errs, errors.New("forbidden to use string template with distinct params or ordered"))
430+
if p.Ordered {
431+
errs = append(errs, errors.New("forbidden to use string template with ordered"))
432+
}
433+
434+
if common.Any(p.DistinctPercentage != 0, p.DistinctCount != 0) {
435+
errs = append(errs, errors.New("forbidden to use string template with distinct params"))
436436
}
437437
}
438438

0 commit comments

Comments
 (0)