Documentation ¶
Index ¶
- func WrapCacheRepository(c repository.Cache, l *log.Logger) repository.Cache
- func WrapUserRepository(r repository.User, c repository.Cache, l *log.Logger) repository.User
- type CacheLog
- type CacheMetric
- type CacheRetryPolicy
- type CacheTracing
- type UserRepositoryCache
- func (u UserRepositoryCache) Fetch(ctx context.Context, criteria domain.Criteria) (users []*aggregate.UserRoot, nextToken domain.PaginationToken, err error)
- func (u UserRepositoryCache) FetchOne(ctx context.Context, byUsername bool, key string) (user *aggregate.UserRoot, err error)
- func (u UserRepositoryCache) HardRemove(ctx context.Context, id string) (err error)
- func (u UserRepositoryCache) Remove(ctx context.Context, id string) (err error)
- func (u UserRepositoryCache) Restore(ctx context.Context, id string) (err error)
- type UserRepositoryMetric
- func (u UserRepositoryMetric) Fetch(ctx context.Context, criteria domain.Criteria) (users []*aggregate.UserRoot, nextToken domain.PaginationToken, err error)
- func (u UserRepositoryMetric) FetchOne(ctx context.Context, byUsername bool, key string) (user *aggregate.UserRoot, err error)
- func (u UserRepositoryMetric) HardRemove(ctx context.Context, id string) (err error)
- func (u UserRepositoryMetric) Remove(ctx context.Context, id string) (err error)
- func (u UserRepositoryMetric) Restore(ctx context.Context, id string) (err error)
- type UserRepositoryTracing
- func (u UserRepositoryTracing) Fetch(ctx context.Context, criteria domain.Criteria) (users []*aggregate.UserRoot, nextToken domain.PaginationToken, err error)
- func (u UserRepositoryTracing) FetchOne(ctx context.Context, byUsername bool, key string) (user *aggregate.UserRoot, err error)
- func (u UserRepositoryTracing) HardRemove(ctx context.Context, id string) (err error)
- func (u UserRepositoryTracing) Remove(ctx context.Context, id string) (err error)
- func (u UserRepositoryTracing) Restore(ctx context.Context, id string) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapCacheRepository ¶
func WrapCacheRepository(c repository.Cache, l *log.Logger) repository.Cache
HoC-like repository wrapping using the chain of responsibility pattern. This wraps required layers to each repository's endpoint such as:
- Observability (Logging, Metrics and Tracing)
- Resiliency strategies (Circuit Breaking and Retry Policy)
func WrapUserRepository ¶
func WrapUserRepository(r repository.User, c repository.Cache, l *log.Logger) repository.User
HoC-like repository wrapping using the chain of responsibility pattern. This wraps required layers to any repository's endpoint such as:
- Observability (Metrics and Tracing)
- Query Caching
- Resiliency strategies (Circuit Breaking and Retry Policy)
Types ¶
type CacheLog ¶
type CacheLog struct { Logger *log.Logger Next repository.Cache }
func (CacheLog) Invalidate ¶
type CacheMetric ¶
type CacheMetric struct {
Next repository.Cache
}
func NewCacheMetric ¶
func NewCacheMetric(n repository.Cache, l *log.Logger) CacheMetric
func (CacheMetric) Invalidate ¶
func (c CacheMetric) Invalidate(ctx context.Context, table, key string) (err error)
type CacheRetryPolicy ¶
type CacheRetryPolicy struct { Logger *log.Logger Next repository.Cache }
func (CacheRetryPolicy) Invalidate ¶
func (c CacheRetryPolicy) Invalidate(ctx context.Context, table, key string) error
type CacheTracing ¶
type CacheTracing struct {
Next repository.Cache
}
func (CacheTracing) Invalidate ¶
func (c CacheTracing) Invalidate(ctx context.Context, table, key string) (err error)
type UserRepositoryCache ¶
type UserRepositoryCache struct { Cache repository.Cache Next repository.User }
func (UserRepositoryCache) Fetch ¶
func (u UserRepositoryCache) Fetch(ctx context.Context, criteria domain.Criteria) (users []*aggregate.UserRoot, nextToken domain.PaginationToken, err error)
func (UserRepositoryCache) HardRemove ¶
func (u UserRepositoryCache) HardRemove(ctx context.Context, id string) (err error)
type UserRepositoryMetric ¶
type UserRepositoryMetric struct {
Next repository.User
}
func NewUserRepositoryMetric ¶
func NewUserRepositoryMetric(n repository.User, l *log.Logger) UserRepositoryMetric
func (UserRepositoryMetric) Fetch ¶
func (u UserRepositoryMetric) Fetch(ctx context.Context, criteria domain.Criteria) (users []*aggregate.UserRoot, nextToken domain.PaginationToken, err error)
func (UserRepositoryMetric) HardRemove ¶
func (u UserRepositoryMetric) HardRemove(ctx context.Context, id string) (err error)
type UserRepositoryTracing ¶
type UserRepositoryTracing struct {
Next repository.User
}
func (UserRepositoryTracing) Fetch ¶
func (u UserRepositoryTracing) Fetch(ctx context.Context, criteria domain.Criteria) (users []*aggregate.UserRoot, nextToken domain.PaginationToken, err error)
func (UserRepositoryTracing) HardRemove ¶
func (u UserRepositoryTracing) HardRemove(ctx context.Context, id string) (err error)
Click to show internal directories.
Click to hide internal directories.