factlist

package
v0.0.0-...-c313e85 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNonNumericFactID = errors.New("fact id must be numeric")
	ErrResourceNotFound = errors.New("resource not found")
	ErrMethodNotAllowed = errors.New("method not allowed")
)

Functions

func NewServer

func NewServer(service Service, logger log.Logger) http.Handler

Types

type ErrInvalidRequestBody

type ErrInvalidRequestBody struct {
	// contains filtered or unexported fields
}

func (ErrInvalidRequestBody) Error

func (e ErrInvalidRequestBody) Error() string

type Middleware

type Middleware func(Service) Service

Middleware describes a Service Middleware

func LoggingMiddleware

func LoggingMiddleware(logger log.Logger) Middleware

type Service

type Service interface {
	Save(context.Context, pkg.Fact) (*pkg.Fact, error)
	List(context.Context) ([]pkg.Fact, error)
	Update(context.Context, pkg.Fact) (*pkg.Fact, bool, error)
	Remove(context.Context, int64) error
}

Service is an application service that lets us interact with a list of facts

func NewService

func NewService(repository pkg.FactRepository) Service

Jump to

Keyboard shortcuts

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