# `Strongbox.Changeset`
[🔗](https://github.com/hattoriai/strongbox/blob/v0.1.0-dev/lib/strongbox/changeset.ex#L1)

Blind indexes kept in step with the fields they index.

    def changeset(user, attrs) do
      user
      |> cast(attrs, [:email])
      |> validate_required([:email])
      |> Strongbox.Changeset.put_indexes()
      |> unique_constraint(:email_index)
    end

# `put_indexes`

```elixir
@spec put_indexes(Ecto.Changeset.t(), keyword()) :: Ecto.Changeset.t()
```

Copies the value of each changed field into the blind indexes whose
`:of` names it, where it is hashed when the changeset is saved.

A field changed to `nil` leaves its index `nil`. Indexes whose field
didn't change are left as they are; pass `force: true` to copy every
indexed field, as `Strongbox.Rotation` does to hash under a new key.

---

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