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
Summary
Functions
Copies the value of each changed field into the blind indexes whose
:of names it, where it is hashed when the changeset is saved.
Functions
@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.