Documentation ¶
Index ¶
- type DefaultMiddleware
- func (m DefaultMiddleware) AddItem(ctx context.Context, newItem todo.NewItem) (todo.Item, error)
- func (m DefaultMiddleware) DeleteItem(ctx context.Context, id string) error
- func (m DefaultMiddleware) DeleteItems(ctx context.Context) error
- func (m DefaultMiddleware) GetItem(ctx context.Context, id string) (todo.Item, error)
- func (m DefaultMiddleware) ListItems(ctx context.Context) ([]todo.Item, error)
- func (m DefaultMiddleware) UpdateItem(ctx context.Context, id string, itemUpdate todo.ItemUpdate) (todo.Item, error)
- type ErrorHandler
- type Events
- type LogEventHandler
- type Logger
- type MarkedAsComplete
- type Middleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultMiddleware ¶
DefaultMiddleware helps implementing partial middleware.
func (DefaultMiddleware) DeleteItem ¶
func (m DefaultMiddleware) DeleteItem(ctx context.Context, id string) error
func (DefaultMiddleware) DeleteItems ¶
func (m DefaultMiddleware) DeleteItems(ctx context.Context) error
func (DefaultMiddleware) UpdateItem ¶
func (m DefaultMiddleware) UpdateItem(ctx context.Context, id string, itemUpdate todo.ItemUpdate) (todo.Item, error)
type Events ¶
type Events interface { // MarkedAsComplete dispatches a MarkedAsComplete event. MarkedAsComplete(ctx context.Context, event MarkedAsComplete) error }
Events dispatches todo events.
type LogEventHandler ¶
type LogEventHandler struct {
// contains filtered or unexported fields
}
LogEventHandler handles todo events and logs them.
func NewLogEventHandler ¶
func NewLogEventHandler(logger Logger) LogEventHandler
NewLogEventHandler returns a new LogEventHandler instance.
func (LogEventHandler) MarkedAsComplete ¶
func (h LogEventHandler) MarkedAsComplete(ctx context.Context, event MarkedAsComplete) error
MarkedAsComplete logs a MarkedAsComplete event.
type MarkedAsComplete ¶
type MarkedAsComplete struct {
ID string
}
MarkedAsComplete event is triggered when an item gets marked as complete.
type Middleware ¶
Middleware is a service middleware.
func EventMiddleware ¶
func EventMiddleware(events Events) Middleware
EventMiddleware fires todo events.
Click to show internal directories.
Click to hide internal directories.