# `Ash.Type.Map`
[🔗](https://github.com/ash-project/ash/blob/v3.23.1/lib/ash/type/map.ex#L5)

Represents a map stored in the database.

In postgres, for example, this represents binary encoded json

A builtin type that can be referenced via `:map`

### Constraints

* `:preserve_nil_values?` (`t:boolean/0`) - If set to true, nil values will be preserved both when storing and in the casted map.
  Otherwise, keys whose values are `nil` will be omitted.  
  preserved_nil_values? is false by default The default value is `false`.

* `:fields` (`t:keyword/0`) - The types of the fields in the map, and their constraints.  
  If constraints are specified, only those fields will be in the casted map.  
  For example:  
      fields:  [
        amount: [
          type: :integer,
          description: "The amount of the transaction",
          constraints: [
            max: 10
          ]
        ],
        currency: [
          type: :string,
          allow_nil?: false,
          description: "The currency code of the transaction",
          constraints: [
            max_length: 3
          ]
        ]
      ]  
  allow_nil? is true by default

  * `:type` (an `Ash.Type`) - Required.

  * `:allow_nil?` (`t:boolean/0`) - The default value is `true`.

  * `:description` (`t:String.t/0`)

  * `:constraints` (`t:keyword/0`) - The default value is `[]`.

# `handle_change?`

# `prepare_change?`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
