dieded

package
v0.0.0-...-465bb87 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound      = errors.New("not found")
	ErrAlreadyDied   = errors.New("already died")
	ErrDuplicateName = errors.New("duplicate name")
)
View Source
var (
	// ErrBadRouting is returned when an expected path variable is missing.
	// It always indicates programmer error.
	ErrBadRouting = errors.New("inconsistent mapping between route and handler (programmer error)")
)

Functions

func MakeCreateProfileEndpoint

func MakeCreateProfileEndpoint(s Service) endpoint.Endpoint

func MakeDeleteProfileEndpoint

func MakeDeleteProfileEndpoint(s Service) endpoint.Endpoint

func MakeDieProfileEndpoint

func MakeDieProfileEndpoint(s Service) endpoint.Endpoint

func MakeGetProfileEndpoint

func MakeGetProfileEndpoint(s Service) endpoint.Endpoint

func MakeHTTPHandler

func MakeHTTPHandler(s Service, logger log.Logger) http.Handler

func MakeQueryProfileEndpoint

func MakeQueryProfileEndpoint(s Service) endpoint.Endpoint

Types

type DieRequest

type DieRequest struct {
	ID int `json:"id"`
}

type Endpoints

type Endpoints struct {
	CreateProfileEndpoint endpoint.Endpoint
	GetProfileEndpoint    endpoint.Endpoint
	QueryProfileEndpoint  endpoint.Endpoint
	DieProfileEndpoint    endpoint.Endpoint
	DeleteProfileEndpoint endpoint.Endpoint
}

func MakeClientEndpoints

func MakeClientEndpoints(instance string) (Endpoints, error)

func MakeServerEndpoints

func MakeServerEndpoints(s Service) Endpoints

func (Endpoints) DeleteProfile

func (e Endpoints) DeleteProfile(ctx context.Context, id int) error

func (Endpoints) GetProfile

func (e Endpoints) GetProfile(ctx context.Context, id int) (*Profile, error)

type Middleware

type Middleware func(Service) Service

func LoggingMiddleware

func LoggingMiddleware(logger log.Logger) Middleware

type Profile

type Profile struct {
	ID     int        `json:"id"`
	Name   string     `json:"name,omitempty"`
	DiedAt *time.Time `json:"died_at,omitempty"`
}

type ProfileForm

type ProfileForm struct {
	Name string `json:"name"`
}

type Query

type Query struct {
	Name string `json:"name,omitempty"`
}

type Service

type Service interface {
	CreateProfile(ctx context.Context, p ProfileForm) (*Profile, error)
	GetProfile(ctx context.Context, id int) (*Profile, error)
	QueryProfile(ctx context.Context, q Query) (*Profile, error)
	DieProfile(ctx context.Context, id int) (*Profile, error)
	DeleteProfile(ctx context.Context, id int) error
}

func NewInmemService

func NewInmemService() Service

Jump to

Keyboard shortcuts

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