aggregatecache

package
v0.0.0-...-70977af Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache[E estoria.Entity] struct {
	// contains filtered or unexported fields
}

func New

func New[E estoria.Entity](client *redis.Client, opts ...CacheOption[E]) *Cache[E]

func (*Cache[E]) GetAggregate

func (c *Cache[E]) GetAggregate(ctx context.Context, aggregateID typeid.UUID) (*aggregatestore.Aggregate[E], error)

func (*Cache[E]) PutAggregate

func (c *Cache[E]) PutAggregate(ctx context.Context, aggregate *aggregatestore.Aggregate[E]) error

type CacheOption

type CacheOption[E estoria.Entity] func(*Cache[E])

func WithMarshaler

func WithMarshaler[E estoria.Entity](marshaler SnapshotMarshaler[E]) CacheOption[E]

type JSONSnapshotMarshaler

type JSONSnapshotMarshaler[E estoria.Entity] struct{}

func (JSONSnapshotMarshaler[E]) Marshal

func (m JSONSnapshotMarshaler[E]) Marshal(snapshot Snapshot[E]) ([]byte, error)

func (JSONSnapshotMarshaler[E]) Unmarshal

func (m JSONSnapshotMarshaler[E]) Unmarshal(data []byte, snapshot *Snapshot[E]) error

type Snapshot

type Snapshot[E estoria.Entity] struct {
	Entity  E     `json:"e"`
	Version int64 `json:"v"`
}

type SnapshotMarshaler

type SnapshotMarshaler[E estoria.Entity] interface {
	Marshal(snapshot Snapshot[E]) ([]byte, error)
	Unmarshal(data []byte, snapshot *Snapshot[E]) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL