Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consumption ¶
Consumption represents a single tea consumption event.
type FDBStore ¶ added in v1.3.2
type FDBStore struct {
// contains filtered or unexported fields
}
FDBStore is a FoundationDB-backed implementation of Store.
func NewFDBStore ¶ added in v1.3.2
NewFDBStore creates a FoundationDB-backed consumption store with the given retention window. If retention <= 0, a default of 30 days is used.
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore is a simple in-memory implementation of Store. It is process-local and not persisted across restarts.
func NewMemoryStore ¶
func NewMemoryStore(retention time.Duration) *MemoryStore
type Store ¶
type Store interface {
Record(ctx context.Context, userID uuid.UUID, teaID uuid.UUID, ts time.Time) error
// Recent returns consumptions since the provided time (inclusive) for the given user.
Recent(ctx context.Context, userID uuid.UUID, since time.Time) ([]Consumption, error)
}
Store defines operations for recording and querying recent tea consumption.
Click to show internal directories.
Click to hide internal directories.