Files
galaxy-game/gamemaster/internal/ports/operationlog.go
T
2026-05-03 07:59:03 +02:00

25 lines
1.0 KiB
Go

package ports
import (
"context"
"galaxy/gamemaster/internal/domain/operation"
)
//go:generate go run go.uber.org/mock/mockgen -destination=../adapters/mocks/mock_operationlog.go -package=mocks galaxy/gamemaster/internal/ports OperationLogStore
// OperationLogStore stores append-only audit entries for every
// operation Game Master performs. Adapters must persist entry verbatim
// and return the generated bigserial id from Append.
type OperationLogStore interface {
// Append inserts entry into the operation log and returns the
// generated bigserial id. Adapters validate entry through
// operation.OperationEntry.Validate before touching the store.
Append(ctx context.Context, entry operation.OperationEntry) (id int64, err error)
// ListByGame returns the most recent entries for gameID, ordered
// by started_at descending and capped by limit. A non-positive
// limit is rejected as invalid input by adapters.
ListByGame(ctx context.Context, gameID string, limit int) ([]operation.OperationEntry, error)
}