Documentation
¶
Index ¶
- Variables
- type OnDeleteFn
- type OnNotFoundFn
- type OnUpdateFn
- type Option
- func WithJetstreamKV[T any, U protoutils.ProtoMessageWithMerge[T]](kv jetstream.KeyValue) Option[T, U]
- func WithKVPrefix[T any, U protoutils.ProtoMessageWithMerge[T]](prefix string) Option[T, U]
- func WithLocks[T any, U protoutils.ProtoMessageWithMerge[T]](l *locks.Locks) Option[T, U]
- func WithOnDeleteFn[T any, U protoutils.ProtoMessageWithMerge[T]](fn OnDeleteFn[T, U]) Option[T, U]
- func WithOnNotFoundFn[T any, U protoutils.ProtoMessageWithMerge[T]](fn OnNotFoundFn[T, U]) Option[T, U]
- func WithOnUpdateFn[T any, U protoutils.ProtoMessageWithMerge[T]](fn OnUpdateFn[T, U]) Option[T, U]
- type Store
- func (s *Store[T, U]) Clear(ctx context.Context) error
- func (s *Store[T, U]) ComputeUpdate(ctx context.Context, key string, load bool, ...) error
- func (s *Store[T, U]) Delete(ctx context.Context, key string) error
- func (s *Store[T, U]) Get(key string) (U, bool)
- func (s *Store[T, U]) GetOrLoad(ctx context.Context, key string) (U, error)
- func (s *Store[T, U]) Keys(ctx context.Context, prefix string) ([]string, error)
- func (s *Store[T, U]) List() ([]U, error)
- func (s *Store[T, U]) Load(ctx context.Context, key string) (U, error)
- func (s *Store[T, U]) Put(ctx context.Context, key string, msg U) error
- func (s *Store[T, U]) Range(ctx context.Context, fn func(key string, value U) bool) error
- func (s *Store[T, U]) Start(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("store: not found")
Functions ¶
This section is empty.
Types ¶
type OnDeleteFn ¶
type OnDeleteFn[T any, U protoutils.ProtoMessageWithMerge[T]] func(s *Store[T, U], entry jetstream.KeyValueEntry, value U) error
type OnNotFoundFn ¶
type OnNotFoundFn[T any, U protoutils.ProtoMessageWithMerge[T]] func(s *Store[T, U], ctx context.Context, key string) (U, error)
type OnUpdateFn ¶
type OnUpdateFn[T any, U protoutils.ProtoMessageWithMerge[T]] func(s *Store[T, U], value U) (U, error)
type Option ¶
type Option[T any, U protoutils.ProtoMessageWithMerge[T]] func(s *Store[T, U])
func WithJetstreamKV ¶ added in v0.9.3
func WithJetstreamKV[T any, U protoutils.ProtoMessageWithMerge[T]](kv jetstream.KeyValue) Option[T, U]
func WithKVPrefix ¶ added in v0.9.3
func WithKVPrefix[T any, U protoutils.ProtoMessageWithMerge[T]](prefix string) Option[T, U]
func WithLocks ¶ added in v0.9.3
func WithLocks[T any, U protoutils.ProtoMessageWithMerge[T]](l *locks.Locks) Option[T, U]
func WithOnDeleteFn ¶ added in v0.9.3
func WithOnDeleteFn[T any, U protoutils.ProtoMessageWithMerge[T]](fn OnDeleteFn[T, U]) Option[T, U]
func WithOnNotFoundFn ¶ added in v0.9.3
func WithOnNotFoundFn[T any, U protoutils.ProtoMessageWithMerge[T]](fn OnNotFoundFn[T, U]) Option[T, U]
func WithOnUpdateFn ¶ added in v0.9.3
func WithOnUpdateFn[T any, U protoutils.ProtoMessageWithMerge[T]](fn OnUpdateFn[T, U]) Option[T, U]
type Store ¶
type Store[T any, U protoutils.ProtoMessageWithMerge[T]] struct { // contains filtered or unexported fields }
func (*Store[T, U]) ComputeUpdate ¶
func (*Store[T, U]) Load ¶
Load data from kv store (this will add/update any existing local data entry) If no key is found, the original nats error is returned.
Click to show internal directories.
Click to hide internal directories.