gomask example
Create example routine configuration from template
gomask example
Create an example routine configuration from a template.
Synopsis
gomask example [OPTIONS]
Description
The example command generates a starter YAML configuration file from a template. This is useful for:
- Learning the YAML structure
- Starting a new routine from scratch
- Getting a reference for all available options
For production use, consider using gomask setup instead, which introspects your actual database.
Options
| Option | Type | Default | Description |
|---|---|---|---|
--type TYPE | string | (required) | Routine type: synthetic or masking |
--name TEXT | string | (prompted) | Display name for the routine |
--id TEXT | string | auto-generated | Unique identifier for the routine |
--output, -o PATH | path | <id>.yaml | Output file path |
--force, -f | flag | false | Overwrite existing file |
--validate | flag | true | Validate generated template |
Examples
Create Synthetic Data Example
gomask example --type synthetic --name "Customer Data"
Output:
Creating synthetic routine example...
✓ Generated: customer-data.yaml
Next steps:
1. Edit the configuration: vim customer-data.yaml
2. Update connector settings
3. Customize tables and columns
4. Validate: gomask validate customer-data.yaml
5. Run: gomask run customer-data.yaml
Create Masking Example
gomask example --type masking --name "PII Masking"
Specify Custom ID
gomask example --type synthetic --name "Test Data" --id test-data-prod
Custom Output Path
gomask example --type synthetic --name "Daily Gen" --output routines/daily.yaml
Force Overwrite
gomask example --type synthetic --name "Test" --force
Generated Templates
Synthetic Data Template
routine:
name: "Customer Data"
description: "Example synthetic data generation routine"
type: synthetic
connector_id: 1 # Your connector ID
settings:
seed: 12345
localization_language: "en"
localization_region: "US"
# Define tables and generation rules
tables:
# Parent table (hierarchy_level: 0)
- table_name: users
schema_name: public
hierarchy_level: 0
target_record_count: 1000
columns:
- column_name: id
generation_function: sequential_integer
generation_parameters:
- name: start
value: 1
- column_name: email
generation_function: generate_email
- column_name: first_name
generation_function: generate_first_name
- column_name: last_name
generation_function: generate_last_name
- column_name: created_at
generation_function: generate_datetime
generation_parameters:
- name: start
value: "2023-01-01"
- name: end
value: "2024-12-31"
# Child table (hierarchy_level: 1)
- table_name: orders
schema_name: public
hierarchy_level: 1
target_record_count: 1000
columns:
- column_name: id
generation_function: sequential_integer
generation_parameters:
- name: start
value: 1
- column_name: user_id
generation_function: reference
generation_parameters:
- name: table
value: users
valueType: reference
- name: column
value: id
- column_name: total
generation_function: generate_decimal
generation_parameters:
- name: min
value: 10.00
- name: max
value: 500.00
- name: precision
value: 2
- column_name: status
generation_function: random_choice
generation_parameters:
- name: choices
value: ["pending", "shipped", "delivered"]
Masking Template
routine:
name: "PII Masking"
description: "Example data masking routine"
type: masking
connector_id: 1 # Your connector ID
settings:
batch_size: 1000
parallel_workers: 4
audit_reporting_enabled: true
tables:
- table_name: users
schema_name: public
columns:
- column_name: email
masking_function: mask_email
masking_config:
- name: preserve_domain
value: false
- column_name: phone
masking_function: mask_phone
masking_config:
- name: preserve_format
value: true
- column_name: ssn
masking_function: mask_ssn
- column_name: first_name
masking_function: generate_first_name
- column_name: last_name
masking_function: generate_last_name
- table_name: payments
schema_name: public
columns:
- column_name: credit_card
masking_function: mask_credit_card
masking_config:
- name: preserve_last
value: 4
- column_name: cvv
masking_function: constant
masking_config:
- name: value
value: "***"
Template vs Setup
| Feature | gomask example | gomask setup |
|---|---|---|
| Database introspection | No | Yes |
| Auto-detect relationships | No | Yes |
| Auto-assign functions | No | Yes |
| Sensitive data detection | No | Yes |
| Ready to run | No (needs editing) | Yes |
| Learning/reference | Excellent | N/A |
Recommendation: Use gomask setup for production routines, gomask example for learning.
Exit Codes
| Code | Description |
|---|---|
| 0 | Template created successfully |
| 1 | Error (file exists, invalid type, etc.) |