Versions in this module Expand all Collapse all v0 v0.0.1 Jul 22, 2024 Changes in this version + var ErrConcurrentUpdate = errors.New("configuration concurrently being updated by someone-else") + var ErrConfigurationNotFound = errors.New("configuration not found") + var ErrNotStarted = errors.New("config store not started - call Start() before using it") + var ErrTypeMustBePointer = errors.New("configuration type argument must be pointer") + func WithCollectionName[T Config](collectionName string) func(repo *WatchedRepo[T]) + func WithNowFn[T Config](nf func() time.Time) func(*WatchedRepo[T]) + func WithSkipIndexOperations[T Config]() func(*WatchedRepo[T]) + type Args struct + DB *mongo.Database + Logger *slog.Logger + type Config interface + Update func(new Config) error + type ListConfigDatesQuery struct + From time.Time + To time.Time + type ListVersionedConfigsQuery struct + FromVersion uint32 + ToVersion uint32 + type UpdateConfigCmd struct + By string + Config T + type Versioned struct + Config T + CreatedAt time.Time + UpdatedBy string + Version uint64 + type WatchedRepo struct + func NewWatchedRepo[T Config](args Args, opts ...func(*WatchedRepo[T])) (*WatchedRepo[T], error) + func (s *WatchedRepo[T]) GetConfig() (T, error) + func (s *WatchedRepo[T]) GetLatestVersion() (*Versioned[T], error) + func (s *WatchedRepo[T]) ListVersionedConfigs(ctx context.Context, query ListVersionedConfigsQuery) ([]*Versioned[T], error) + func (s *WatchedRepo[T]) ListVersionedConfigsByDate(ctx context.Context, query ListConfigDatesQuery) ([]*Versioned[T], error) + func (s *WatchedRepo[T]) Start(ctx context.Context) (<-chan struct{}, error) + func (s *WatchedRepo[T]) UpdateConfig(ctx context.Context, cmd UpdateConfigCmd[T]) (*Versioned[T], error)