Documentation ¶
Index ¶
- type CacheActionCause
- type CachedRepository
- func (c *CachedRepository[BaseEntity, ProcessedEntity, ChangeContext]) Create(ctx context.Context, name string, entity BaseEntity, ...) error
- func (c *CachedRepository[BaseEntity, ProcessedEntity, ChangeContext]) Delete(ctx context.Context, name string, changeContext *ChangeContext) error
- func (c *CachedRepository[BaseEntity, ProcessedEntity, ChangeContext]) Read(ctx context.Context, name string) (ProcessedEntity, string, error)
- func (c *CachedRepository[BaseEntity, ProcessedEntity, ChangeContext]) ReadAll(ctx context.Context) (map[string]ProcessedEntity, error)
- func (c *CachedRepository[BaseEntity, ProcessedEntity, ChangeContext]) Reconcile(ctx context.Context, name string) error
- func (c *CachedRepository[BaseEntity, ProcessedEntity, ChangeContext]) ReconcileAll(ctx context.Context) error
- func (c *CachedRepository[BaseEntity, ProcessedEntity, ChangeContext]) Update(ctx context.Context, name string, entity BaseEntity, modifyIfMatchHash string, ...) error
- type CustomCompare
- type CustomHash
- type ErrHashMismatch
- type ErrRepositoryEntityNotFound
- type Hooks
- type Processor
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheActionCause ¶
type CacheActionCause int64
const ( CacheActionCauseRepositoryAction CacheActionCause = iota CacheActionCauseReconciliation )
type CachedRepository ¶
type CachedRepository[BaseEntity any, ProcessedEntity any, ChangeContext any] struct { // contains filtered or unexported fields }
func NewCachedRepository ¶
func NewCachedRepository[BaseEntity any, ProcessedEntity any, ChangeContext any]( key string, repository Repository[BaseEntity, ChangeContext], cache aucache.Cache[ProcessedEntity], processor Processor[BaseEntity, ProcessedEntity], locker aulocker.Locker, hooks Hooks[ProcessedEntity], ) *CachedRepository[BaseEntity, ProcessedEntity, ChangeContext]
func (*CachedRepository[BaseEntity, ProcessedEntity, ChangeContext]) Create ¶
func (c *CachedRepository[BaseEntity, ProcessedEntity, ChangeContext]) Create( ctx context.Context, name string, entity BaseEntity, changeContext *ChangeContext, ) error
func (*CachedRepository[BaseEntity, ProcessedEntity, ChangeContext]) Delete ¶
func (c *CachedRepository[BaseEntity, ProcessedEntity, ChangeContext]) Delete( ctx context.Context, name string, changeContext *ChangeContext, ) error
func (*CachedRepository[BaseEntity, ProcessedEntity, ChangeContext]) ReadAll ¶
func (c *CachedRepository[BaseEntity, ProcessedEntity, ChangeContext]) ReadAll( ctx context.Context, ) (map[string]ProcessedEntity, error)
func (*CachedRepository[BaseEntity, ProcessedEntity, ChangeContext]) Reconcile ¶
func (c *CachedRepository[BaseEntity, ProcessedEntity, ChangeContext]) Reconcile( ctx context.Context, name string, ) error
func (*CachedRepository[BaseEntity, ProcessedEntity, ChangeContext]) ReconcileAll ¶
func (c *CachedRepository[BaseEntity, ProcessedEntity, ChangeContext]) ReconcileAll( ctx context.Context, ) error
type CustomCompare ¶
ToDo: Use later for custom compare
type CustomHash ¶
ToDo: Use later for custom hash
type ErrHashMismatch ¶
type ErrHashMismatch struct {
// contains filtered or unexported fields
}
func NewErrHashMismatch ¶
func NewErrHashMismatch( providedHash string, actualHash string, ) ErrHashMismatch
func (ErrHashMismatch) Error ¶
func (e ErrHashMismatch) Error() string
type ErrRepositoryEntityNotFound ¶
type ErrRepositoryEntityNotFound struct {
// contains filtered or unexported fields
}
func NewErrRepositoryEntityNotFound ¶
func NewErrRepositoryEntityNotFound(name string) ErrRepositoryEntityNotFound
func (ErrRepositoryEntityNotFound) Error ¶
func (e ErrRepositoryEntityNotFound) Error() string
type Hooks ¶
type Hooks[Entity any] interface { OnRepositoryEntityCreated( ctx context.Context, name string, entity Entity, ) error OnRepositoryEntityUpdated( ctx context.Context, name string, entity Entity, ) error OnRepositoryEntityDeleted( ctx context.Context, name string, ) error OnCacheEntityAdded( ctx context.Context, name string, entity Entity, cause CacheActionCause, ) error OnCacheEntityUpdated( ctx context.Context, name string, entity Entity, cause CacheActionCause, ) error OnCacheEntityRemoved( ctx context.Context, name string, cause CacheActionCause, ) error }
type Processor ¶
type Processor[BaseEntity any, ProcessedEntity any] interface { ProcessEntity( ctx context.Context, entity BaseEntity, ) (ProcessedEntity, error) InverseProcessEntity( ctx context.Context, entity ProcessedEntity, ) (BaseEntity, error) }
func NewNoProcessor ¶
type Repository ¶
type Repository[Entity any, ChangeContext any] interface { Create( ctx context.Context, name string, entity Entity, changeContext *ChangeContext, ) error ReadAll( ctx context.Context, ) (map[string]Entity, error) Read( ctx context.Context, name string, ) (Entity, error) Update( ctx context.Context, name string, entity Entity, changeContext *ChangeContext, ) error Delete( ctx context.Context, name string, changeContext *ChangeContext, ) error }
Click to show internal directories.
Click to hide internal directories.