Ash.Resource.Change.AtomicSet (ash v3.19.3)

Copy Markdown View Source

A change that sets an attribute using an expression evaluated in the data layer during create.

This is used by the atomic_set/3 builtin change. Unlike Ash.Resource.Change.Atomic (used by atomic_update/3), this is for setting values during the INSERT phase of create actions, not for updating existing values.

The expression cannot reference existing database values via atomic_ref/1 since there is no existing row during creates.

When used on update actions, behaves the same as atomic_update/3.

Return Value

The atomic/3 callback returns {:atomic_set, atomics} which tells Ash to apply these values during the INSERT phase (stored in changeset.create_atomics).