id_registry library
Cross-collection uniqueness, validation and generation for id pair sets.
Classes
- CachedIdStorage
- An IdStorage decorator that keeps reads in memory and passes writes on.
- DuplicateIdFailure
- An id is already registered for its type.
-
Either<
L, R> - Represents a value of one of two possible types, Left or Right.
-
Eq<
T> -
A type class used to determine equality between 2 instances of the same type
T. Any 2 instancesxandyare equal ifeqv(x, y)istrue. - FileBasedIdStorage
- An IdStorage persisted as one JSON file, loaded on first use.
-
Hash<
T> - A type class used to represent a hashing scheme for objects of a given type.
-
HKT<
G, A> - https://marcosh.github.io/post/2020/04/15/higher-kinded-types-php-solution.html https://medium.com/@gcanti/higher-kinded-types-in-flow-275b657992b7
-
HKT2<
G1, G2, A> -
HKT3<
G1, G2, G3, A> - IdGenerationFailure
- Generation ran out of room to mint a free id.
-
IdPair<
T extends Object> - One identifier for one thing: a namespace (idType) and the code it holds.
-
IdPairSet<
T extends IdPair< Object> > - An immutable set of IdPairs holding at most one id per id type.
- IdRegistryFailure
- Everything the registry can refuse to do, as a value rather than a throw.
- IdRegistryRepository
- Uniqueness, validation and generation for ids across many collections.
- IdRegistryRepositoryImpl
- An IdRegistryRepository over any IdStorage.
- IdStorage
- The mechanical store behind a registry: id codes per id type, plus counters.
- IdStorageFailure
- Everything that can go wrong while storing registered ids.
- IdValidator
- A rule an id code must satisfy for one id type.
- InMemoryIdStorage
- An IdStorage held in maps: codes per id type, plus counters.
- InvalidIdFailure
- An id failed the validator registered for its type.
-
IO<
A> -
IO<A>represents a non-deterministic synchronous computation that can cause side effects, yields a value of typeAand never fails. -
IOEither<
L, R> -
IOEither<L, R>represents a non-deterministic synchronous computation that can cause side effects, yields a value of typeRor can fail by returning a value of typeL. -
IOOption<
R> -
IOOption<R>represents an synchronous computation that may fails yielding a None or returns aSome(R)when successful. -
IORef<
T> - Mutable reference in the IO monad.
- Isbn13IdValidator
- Validates ISBN-13 codes, including the trailing check digit.
- IsbnIdValidator
- Validates ISBN-10 codes, including the trailing check digit.
-
Left<
L, R> - MissingGeneratorFailure
- No generator was registered for the requested id type.
- None
-
Option<
T> -
A type that can contain a value of type
Tin a Some or no value with None. - OrcidIdValidator
-
Validates ORCID identifiers:
0000-0000-0000-000X, check digit included. -
Order<
T> -
The
Ordertype class is used to define a total ordering on some typeA. -
PartialOrder<
T> -
The
PartialOrdertype class is used to define a partial ordering on some typeA. -
Reader<
R, A> -
Reader<R, A>allows to read valuesAfrom a dependency/contextRwithout explicitly passing the dependency between multiple nested function calls. - ReaderHKT
- Tag the HKT2 interface for the actual Reader.
-
ReaderTask<
E, A> -
ReaderTask represents an asynchronous computation that yields a value of type
Afrom a context of typeEand never fails. -
ReaderTaskEither<
E, L, R> -
ReaderTaskEither<E, L, R>represents an asynchronous computation (Task) that either yields a value of typeRor fails yielding an error of typeL(Either), that allows to read values from a dependency/contextE(Reader). - RegistryStorageFailure
- The registry could not reach its storage, or storage refused the write.
-
Right<
L, R> - SimpleIdPair
- The common case: an identifier namespaced by a plain String.
-
Some<
T> -
State<
S, A> -
State<S, A>is used to store, update, and extract state in a functional way. -
StateAsync<
S, A> -
StateAsync<S, A>is used to store, update, and extract async state in a functional way. - The storage could not be read or written — a missing file, bad permissions, malformed persisted content.
-
Task<
A> -
Task represents an asynchronous computation that yields a value of type
Aand never fails. -
TaskEither<
L, R> -
TaskEither<L, R>represents an asynchronous computation that either yields a value of typeRor fails yielding an error of typeL. -
TaskOption<
R> -
TaskOption<R>represents an asynchronous computation that may fails yielding a None or returns aSome(R)when successful. - Unit
-
Used instead of
voidas a return statement for a function when no value is to be returned.
Enums
- DuplicatePolicy
-
How an
IdPairSetresolves two pairs that share an id type. - IdGeneratorType
- The kind of ids a registry mints for an id type.
Mixins
-
Alt<
KT, A> -
Alttype class identifies an associative operation on a type constructor. -
Alt2<
KT, A, B> -
Alt3<
KT, P1, P2, P3> -
Applicative<
G, A> -
Applicative2<
G, A, B> -
Applicative3<
G, A, B, C> -
Band<
T> -
Bands are semigroups whose operation
(i.e.
combine) is also idempotent (an operation that can be applied multiple times without changing the result beyond the initial application). -
BoundedSemilattice<
T> - A semilattice in which:
-
CommutativeGroup<
T> - An commutative group (also known as an abelian group) is a group whose combine operation is commutative.
-
CommutativeMonoid<
T> -
CommutativeMonoidrepresents a commutative monoid. -
CommutativeSemigroup<
T> -
CommutativeSemigrouprepresents a commutative semigroup. -
Extend<
KT, A> -
Extend2<
KT, A, B> -
Filterable<
KT, A> -
Foldable<
G, A> -
Foldable2<
G, A, B> -
Functor<
G, A> -
Functor<G, A> extends HKT<G, A>to express the fact that the classes implementing the Functor interface will need to be higher kinded types. -
Functor2<
G, A, B> -
Functor3<
G, A, B, C> -
Group<
T> - A group is a monoid where each element has an inverse.
-
Monad<
KT, A> -
Monad2<
KT, A, B> -
Monad3<
KT, P1, P2, P3> -
Monoid<
T> -
A monoid is a semigroup with an identity (
empty). -
Semigroup<
T> -
A semigroup is any set
Awith an associative operation (combine). -
Semilattice<
T> -
Semilattices
are commutative semigroups whose operation
(i.e.
combine) is also idempotent.
Extensions
-
CompositionEitherExtension
on Task<
Either< L, R> > -
CompositionOptionExtension
on Task<
Option< T> > - CurryExtension2 on Output Function(Input1, Input2)
- Extract first parameter from this function to allow curring.
- CurryExtension3 on Output Function(Input1, Input2, Input3)
- CurryExtension4 on Output Function(Input1, Input2, Input3, Input4)
- CurryExtension5 on Output Function(Input1, Input2, Input3, Input4, Input5)
- FpdartOnDateTime on DateTime
-
fpdartextension methods on DateTime -
FpdartOnIterable
on Iterable<
T> -
Get the first element of the Iterable.
If the Iterable is empty, return None.
Functional programming functions on a mutable dart Iterable using
fpdart. -
FpdartOnIterableOfIterable
on Iterable<
Iterable< T> > -
Functional programming functions on
Iterable<Iterable<T>>usingfpdart. -
FpdartOnList
on List<
T> -
Functional programming functions on a mutable dart Iterable using
fpdart. -
FpdartOnMap
on Map<
K, V> -
Functional programming functions on a mutable dart Map using
fpdart. -
FpdartOnOption
on Option<
T> -
FpdartOnOptionMap
on Option<
Map< K, dynamic> > - FpdartOnPredicate on bool Function()
- FpdartOnPredicate1 on bool Function(P)
- FpdartOnString on String
-
Functional programming functions on dart String using
fpdart. -
FpdartSequenceIterableEither
on Iterable<
Either< E, A> > -
FpdartSequenceIterableIO
on Iterable<
IO< T> > -
FpdartSequenceIterableIOEither
on Iterable<
IOEither< E, T> > -
FpdartSequenceIterableIOOption
on Iterable<
IOOption< T> > -
FpdartSequenceIterableOption
on Iterable<
Option< T> > -
FpdartSequenceIterableState
on Iterable<
State< S, A> > -
Convert a
List<State<S, A>>to a singleState<S, List<A>>. -
FpdartSequenceIterableTask
on Iterable<
Task< T> > -
FpdartSequenceIterableTaskEither
on Iterable<
TaskEither< E, T> > -
FpdartSequenceIterableTaskOption
on Iterable<
TaskOption< T> > -
FpdartTraversableIterable
on Iterable<
T> - UncurryExtension2 on Output Function(Input2) Function(Input1)
- UncurryExtension3 on Output Function(Input3) Function(Input2) Function(Input1)
- UncurryExtension4 on Output Function(Input4) Function(Input3) Function(Input2) Function(Input1)
- UncurryExtension5 on Output Function(Input5) Function(Input4) Function(Input3) Function(Input2) Function(Input1)
Constants
Properties
-
dateNow
→ IO<
DateTime> -
Constructs a DateTime instance with current date and time in the local time zone.
no setter
-
ioRefEq
→ Eq<
IORef< Object?> > -
Eq instance to compare IORefs using pointer equality
final
-
now
→ IO<
int> -
The number of milliseconds since the "Unix epoch" 1970-01-01T00:00:00Z (UTC).
no setter
-
random
→ IO<
double> -
Generates a non-negative random floating point
value uniformly distributed in the range from 0.0, inclusive, to 1.0, exclusive.
no setter
-
randomBool
→ IO<
bool> -
Generates a random boolean value.
no setter
Functions
-
boolAndMonoid(
) → Monoid< bool> -
boolOrMonoid(
) → Monoid< bool> -
constF<
A> (A a) → A Function(dynamic b) -
constf ais a unary function which evaluates toafor all inputs. -
dualEndoMonoid<
A> () → Monoid< Endo< A> > -
endoMonoid<
A> () → Monoid< Endo< A> > -
identity<
T> (T a) → T -
Returns the given
a. -
identityFuture<
T> (T a) → Future< T> -
Returns the given
a, wrapped inFuture.value. -
idTypeKey(
{required Object idType}) → String - Names an id type the way it is stored: an enum by value name, else as text.
-
left<
L, R> (L l) → Either< L, R> -
Return a
Left(l). -
modifyIORef<
T> (Endo< T> update, IORef<T> ref) → IO<Unit> -
Works almost identical to the
writemethod, but instead of taking a value that needs to be written, takes an Endo function, applies the IORef's current value to it and writes the result to the IORef. -
modifyIORefC<
T> (Endo< T> update) → IO<Unit> Function(IORef<T> ref) - A curried version of the modifyIORef
-
newIORef<
T> (T initial) → IO< IORef< T> > - Creates a new IORef inside an IO monad with a given initial value.
-
none<
T> () → Option< T> - Return a None.
-
option<
T> (T value, bool predicate(T)) → Option< T> -
Return Some of
valuewhenpredicateapplied tovaluereturnstrue, None otherwise. -
optionOf<
T> (T? t) → Option< T> -
Return None if
tisnull, Some otherwise. -
randomInt(
int min, int max) → IO< int> -
Generates a non-negative random integer uniformly distributed
in the range from
min, inclusive, tomax, exclusive. -
readIORef<
T> (IORef< T> ref) → IO<T> - Extracts a current value of the IORef and returns it inside the IO monad.
-
right<
L, R> (R r) → Either< L, R> -
Return a
Right(r). -
some<
T> (T t) → Option< T> -
Return a
Some(t). -
toBoolEither<
L> (String str, L onLeft()) → Either< L, bool> -
Convert this String to bool, returns the result of
onLeftfor invalid inputs. -
toBoolOption(
String str) → Option< bool> - Convert this String to bool, returns None for invalid inputs.
-
toDoubleEither<
L> (L onLeft()) → Either< L, double> Function(String) -
Convert this String to double, returns the result of
onLeftfor invalid inputs. -
toDoubleOption(
String str) → Option< double> - Convert this String to double, returns None for invalid inputs.
-
toIntEither<
L> (L onLeft()) → Either< L, int> Function(String) -
Convert this String to int, returns the result of
onLeftfor invalid inputs. -
toIntOption(
String str) → Option< int> - Convert this String to int, returns None for invalid inputs.
-
toNumEither<
L> (L onLeft()) → Either< L, num> Function(String) -
Convert this String to num, returns the result of
onLeftfor invalid inputs. -
toNumOption(
String str) → Option< num> - Convert this String to num, returns None for invalid inputs.
-
writeIORef<
T> (T value, IORef< T> ref) → IO<Unit> - Writes the given value to the IORef and returns a Unit inside the IO monad.
-
writeIORefC<
T> (T value) → IO< Unit> Function(IORef<T> ref) - A curried version of the writeIORef
Typedefs
-
DoAdapterEither<
L> = R Function< R>(Either< L, R> ) -
DoAdapterIO
= A Function<
A>(IO< A> ) -
DoAdapterIOEither<
E> = A Function< A>(IOEither< E, A> ) -
DoAdapterIOOption
= A Function<
A>(IOOption< A> ) -
DoAdapterOption
= A Function<
A>(Option< A> ) -
DoAdapterReaderTask<
E> = Future< A> Function<A>(ReaderTask< E, A> ) -
DoAdapterReaderTaskEither<
E, L> = Future< A> Function<A>(ReaderTaskEither< E, L, A> ) -
DoAdapterTask
= Future<
A> Function<A>(Task< A> ) -
DoAdapterTaskEither<
E> = Future< A> Function<A>(TaskEither< E, A> ) -
DoAdapterTaskOption
= Future<
A> Function<A>(TaskOption< A> ) -
DoFunctionEither<
L, R> = R Function(DoAdapterEither< L> $) -
DoFunctionIO<
A> = A Function(DoAdapterIO $) -
DoFunctionIOEither<
L, A> = A Function(DoAdapterIOEither< L> $) -
DoFunctionIOOption<
A> = A Function(DoAdapterIOOption $) -
DoFunctionOption<
A> = A Function(DoAdapterOption $) -
DoFunctionReaderTask<
E, A> = Future< A> Function(DoAdapterReaderTask<E> $) -
DoFunctionReaderTaskEither<
E, L, A> = Future< A> Function(DoAdapterReaderTaskEither<E, L> $) -
DoFunctionTask<
A> = Future< A> Function(DoAdapterTask $) -
DoFunctionTaskEither<
L, A> = Future< A> Function(DoAdapterTaskEither<L> $) -
DoFunctionTaskOption<
A> = Future< A> Function(DoAdapterTaskOption $) -
Endo<
A> = A Function(A a) -
Separated<
KT, A, B> = (HKT< KT, A> , HKT<KT, B> )