# HStore Mask (HStoreMaskGenerator)

The [HStore Mask](https://docs.tonic.ai/app/generation/generators/generator-reference/hstore-mask) generator runs selected generators on specified key values in an HStore column in a PostgreSQL database. HStore columns contain a set of key-value pairs.

## Link object structure <a href="#generator-api-hstore-mask-link-object" id="generator-api-hstore-mask-link-object"></a>

For the HStore Mask generator, there is a link object for each path expression value to assign a generator to.

The generator does not itself support consistency or differential privacy.

The `metadata` object is populated from the [`HStoreMaskMetadata`](https://app.tonic.ai/apidocs/index.html#/models/HStoreMaskMetadata) object. It includes:

* `pathExpression`, which is the path expression that identifies the value to apply the sub-generator to.
* The `subGeneratorMetadata` object, which identifies and configures the sub-generator.

<pre class="language-json" data-overflow="wrap"><code class="lang-json">{
  "schema": "string",
  "table": "string",
  "column": "string",
  "metadata": {
    "generatorId": "HStoreMaskGenerator",
    "presetId": "string",
    "customValueProcessor": "string",  //If custom value processor assigned to the generator
    "pathExpression": "string",
    "subGeneratorMetadata": {
      "generatorId": "string",
      "presetId": "string",
      //Metadata for the selected sub-generator
<strong>      "customValueProcessor": "string" //If custom value processor assigned to the sub-generator
</strong>    }
  }
}
</code></pre>

## Example replacement <a href="#generator-api-hstore-mask-replacement" id="generator-api-hstore-mask-replacement"></a>

In the following example replacement for the HStore Mask generator:

* The Random Integer generator is assigned to the value of the `pages` path expression. The generator uses values between 300 and 500.
* The Character Scramble generator is assigned to the value of the `title` path expression. Consistency is disabled.

```json
{
  "name": "hstore_col",
  "schema": "public",
  "table": "books",
  "links": [
    {
      "schema": "public",
      "table": "books",
      "column": "book_details",
      "metadata": {
        "generatorId": "HStoreMaskGenerator",
        "presetId": "HStoreMaskGenerator",
        "pathExpression": "pages",
        "subGeneratorMetadata": {
          "presetId": "RandomIntegerGenerator",
          "generatorId": "RandomIntegerGenerator",
          "min": 300,
          "max": 500
        }
      }
    },
    {
      "column": "book_details",
      "table": "books",
      "schema": "public",
      "metadata": {
        "generatorId": "HStoreMaskGenerator",
        "presetId": "HStoreMaskGenerator",
        "pathExpression": "title",
        "subGeneratorMetadata": {
          "isConsistent": false,
          "presetId": "TextMaskGenerator",
          "generatorId": "TextMaskGenerator"
        }
      }
    }
  ]
}
```
