Documentation ¶
Index ¶
- func Broadcast[T any](receivers []func(T), property Property[T]) *broadcast[T]
- func Cache[T any](value T, property Property[T]) *cache[T]
- func Guard[T any](cons Constraint[T], property Property[T]) guard[T]
- func Inequality[T comparable](property Property[T]) inequality[T]
- func LazyCache[T any](property Property[T]) *lazyCache[T]
- type Constraint
- type Property
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Broadcast ¶
Broadcast returns implementation of Property[T any] interface. it is responsible for notifing all revicers synchronously when value of underlying property get updated.
Broadcast is useful when a property represents a natural primary key, which has to change and any other properties that depends upon the old primary key must get updated.
receivers is a slice of functions so client can choose appropriate message name panic when:
- property is nil
- recivers is nil.
- recivers has nil function (default panic message).
func Cache ¶
Cache implements Property[T any] interface which provides the ability to save value in memory. Cache represents eager loading since value must be provided at construction time.
messages:
- Change updates underlying property and in memory value if no error occur.
- Value returns in-memory cached value and nil.
Panic when property argument is nil ¶
See Cacheable if lazy loading is needed.
func Guard ¶ added in v0.2.0
func Guard[T any](cons Constraint[T], property Property[T]) guard[T]
func Inequality ¶ added in v0.2.0
func Inequality[T comparable](property Property[T]) inequality[T]