# Struct Mask

This is a [composite generator](https://docs.tonic.ai/app/generation/generators/generator-types/generators-composite).

Applies selected generators to specific StructFields within a StructType in a Databricks database.

For example, for the following StructType:

```
root
 |-- firstname: string (nullable = true)
 |-- lastname: string (nullable = true)
 |-- age: integer (nullable = true)
 |-- occupation: string (nullable = true)
 |-- salary: integer (nullable = true)


firstname | lastname | age | occupation | salary
-------------------------------------------------
John      | Smith    | 25  | Teacher    | 45000
```

To get the value of the `occupation` field, you would use the expression `root.occupation`.

## Characteristics <a href="#struct-mask-characteristics" id="struct-mask-characteristics"></a>

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top"><strong>Consistency</strong></td><td valign="top">Determined by the selected sub-generators.</td></tr><tr><td valign="top"><strong>Linking</strong></td><td valign="top">Determined by the selected sub-generators.</td></tr><tr><td valign="top"><strong>Differential privacy</strong></td><td valign="top">Determined by the selected sub-generators.</td></tr><tr><td valign="top"><strong>Data-free</strong></td><td valign="top">Determined by the selected sub-generators.</td></tr><tr><td valign="top"><strong>Allowed for primary keys</strong></td><td valign="top">No</td></tr><tr><td valign="top"><strong>Allowed for unique columns</strong></td><td valign="top">No</td></tr><tr><td valign="top"><strong>Uses format-preserving encryption (FPE)</strong></td><td valign="top">No</td></tr><tr><td valign="top"><strong>Privacy ranking</strong></td><td valign="top">5</td></tr><tr><td valign="top"><strong>Generator ID (for the API)</strong></td><td valign="top"><a href="../../../api/quick-start-guide/tonic-api-generator-assignment/generator-api-reference/generator-api-ref-struct-mask"><code>StructMaskGenerator</code></a></td></tr></tbody></table>

## How to configure <a href="#struct-mask-configure" id="struct-mask-configure"></a>

### Adding a sub-generator <a href="#struct-mask-add-sub-generator" id="struct-mask-add-sub-generator"></a>

To assign a generator to a path expression:

1. Under **Sub-generators**, click **Add Generator**.\
   \
   On the sub-generator configuration panel, the **Cell Struct** field contains a sample value from the source database. You can use the previous and next icons to page through different values.
2. In the **Path Expression** field, type the path expression to identify the value to apply the generator to.\
   \
   **Matched Struct Values** shows the result from the value in **Cell Struct**.
3. From the **Generator Configuration** dropdown list, select the generator to apply to the path expression.\
   \
   You cannot select another composite generator.
4. Configure the selected generator.\
   \
   You cannot configure the selected generator to be consistent with another column.
5. To save the configuration and close the add generator panel, click **Save**.

### Managing sub-generators <a href="#struct-mask-manage-sub-generators" id="struct-mask-manage-sub-generators"></a>

From the **Sub-Generators** list:

* To edit a generator assignment, click the edit icon.
* To remove a generator assignment, click the delete icon.
* To move a generator assignment up or down in the list, click the up or down arrow.
