The :condition of a conditional Decree.Store.append_to_stream/4.
A condition is a keyword list:
items- aDecree.Store.Querylist of items.after- a position in$all, theafterof a completeDecree.Store.read_query/2. The append fails if any event past it matchesitems. Mandatory: an absentaftermust never become a plain append.target- optional, any term. It names what the condition protects, for a store that declares it inconditional_appends, and is compared and nothing else. A condition with one is declared by that target alone, and one with none by its streams' prefixes, so a declared prefix does not let an undeclared target in.
See "Conditional appends" in Decree.Store. A store that declares deletable refuses a
condition naming it with {:error, :query_names_deletable}, as it refuses a read: see
"Deletable streams" there.
Summary
Functions
Compiles a condition.
Types
@type t() :: %Decree.Store.AppendCondition{ after: non_neg_integer(), query: Decree.Store.Query.t(), target: term() }
Functions
@spec compile(condition :: term()) :: {:ok, t()} | {:error, :invalid_condition} | {:error, :invalid_query} | {:error, :tag_too_long}
Compiles a condition.
Answers {:error, :invalid_condition} for anything but a keyword list of exactly the
keys above with a usable after, and passes on {:error, :invalid_query} and
{:error, :tag_too_long} from Decree.Store.Query.compile/1. A refusal sends nothing
to the database, so a caller's transaction stays alive.