todo

package
v0.0.0-...-468a20b Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: MIT Imports: 4 Imported by: 0

README

TodoBackend example

Code can be found at https://github.com/sagikazarmark/todobackend-go-kit

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultMiddleware

type DefaultMiddleware struct {
	Service todo.Service
}

DefaultMiddleware helps implementing partial middleware.

func (DefaultMiddleware) AddItem

func (m DefaultMiddleware) AddItem(ctx context.Context, newItem todo.NewItem) (todo.Item, error)

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) GetItem

func (m DefaultMiddleware) GetItem(ctx context.Context, id string) (todo.Item, error)

func (DefaultMiddleware) ListItems

func (m DefaultMiddleware) ListItems(ctx context.Context) ([]todo.Item, error)

func (DefaultMiddleware) UpdateItem

func (m DefaultMiddleware) UpdateItem(ctx context.Context, id string, itemUpdate todo.ItemUpdate) (todo.Item, error)

type ErrorHandler

type ErrorHandler = common.ErrorHandler

ErrorHandler handles an 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 Logger

type Logger = common.Logger

Logger is the fundamental interface for all log operations.

type MarkedAsComplete

type MarkedAsComplete struct {
	ID string
}

MarkedAsComplete event is triggered when an item gets marked as complete.

type Middleware

type Middleware func(todo.Service) todo.Service

Middleware is a service middleware.

func EventMiddleware

func EventMiddleware(events Events) Middleware

EventMiddleware fires todo events.

Jump to

Keyboard shortcuts

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