Class CollectionEdit<TKey, TIdentity, TState>
- Namespace
- SodaFlow.Collections
- Assembly
- SodaFlow.Core.Collections.dll
An edit from a caller. An update holds a transform and not a value, thus it composes against the state at the time of the transaction.
[PublicAPI]
public sealed class CollectionEdit<TKey, TIdentity, TState> where TKey : notnull where TIdentity : notnull
Type Parameters
TKeyThe type of the keys.
TIdentityThe type of the immutable part of an item.
TStateThe type of the mutable part of an item.
- Inheritance
-
CollectionEdit<TKey, TIdentity, TState>
- Inherited Members
- Extension Methods
Constructors
- CollectionEdit(IReadOnlyDictionary<TKey, Func<TState, TState>>, IReadOnlyCollection<Item<TIdentity, TState>>, IReadOnlyCollection<TKey>)
Creates an edit from its three parts.
Properties
- Adds
The items to add.
- Empty
The edit that changes nothing.
- Removes
The keys to remove.
- Updates
The transforms to apply, by key.
Methods
- Add(params Item<TIdentity, TState>[])
An edit adding one or more items.
- CombineWith(CollectionEdit<TKey, TIdentity, TState>)
Puts two edits from one transaction together. SodaFlow gives no sequence between them, thus this method refuses an operation that uses a sequence and does not resolve it with no message. Two transforms for one key in one transaction compose in a sequence that SodaFlow does not give.
- FromAdds(Stream<Item<TIdentity, TState>>)
Lifts a stream of items into edits which add them.
- FromRemoves(Stream<TKey>)
Lifts a stream of keys into edits which remove them.
- FromStates(TKey, Stream<TState>)
Lifts a stream of new states for one fixed key into edits.
- FromUpdates(Stream<(TKey Key, Func<TState, TState> Transform)>)
Lifts a stream of keyed transforms into edits, for wiring at collection construction.
- FromUpdates(TKey, Stream<Func<TState, TState>>)
Lifts a stream of transforms for one fixed key into edits — the usual shape when a view drives a single item.
- Remove(params TKey[])
An edit removing one or more keys.
- Update(TKey, Func<TState, TState>)
An edit applying one transform to one key.