Documentation
¶
Index ¶
- type Store
- func (s *Store[T]) ReadRaw(fn func(*T) error) error
- func (s *Store[T]) TryLock(ctx context.Context) (bool, error)
- func (s *Store[T]) Unlock(ctx context.Context) error
- func (s *Store[T]) Update(ctx context.Context, fn func(*T) error) error
- func (s *Store[T]) With(ctx context.Context, fn func(*T) error) error
- func (s *Store[T]) WriteRaw(fn func(*T) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store[T any] struct { // contains filtered or unexported fields }
func (*Store[T]) ReadRaw ¶
ReadRaw loads the JSON file and passes the decoded data to fn without locking.
func (*Store[T]) Update ¶
Update acquires the lock, loads, mutates via fn, and atomically writes back.
Click to show internal directories.
Click to hide internal directories.