handlers

package
v0.0.0-...-3f93e99 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handle

func Handle(w http.ResponseWriter, r *http.Request, o Operation)

Handle operation

Types

type CreateService

type CreateService interface {
	Create(*http.Request, interface{}) (interface{}, error)
}

CreateService interface

type GetService

type GetService interface {
	GetOne(*http.Request) (interface{}, error)
}

GetService interface

type Handler

type Handler struct {
	Operation
}

Handler definition

func (Handler) Handle

func (h Handler) Handle(w http.ResponseWriter, r *http.Request)

Handle operation

type ListService

type ListService interface {
	GetList(*http.Request) ([]interface{}, error)
}

ListService interface

type MapService

type MapService interface {
	PayloadMapper
	ModelMapper
}

MapService interface

type ModelMapper

type ModelMapper interface {
	ModelToPayload(interface{}) interface{}
}

ModelMapper interface

type Operation

type Operation interface {
	Execute(w http.ResponseWriter, r *http.Request)
}

Operation interface

func Create

func Create(payload interface{}, service CreateService, mapper MapService, l logger.Logger) Operation

Create operation

func Get

func Get(service GetService, mapper ModelMapper, l logger.Logger) Operation

Get operation

func List

func List(service ListService, mapper ModelMapper, l logger.Logger) Operation

List operation

func Remove

func Remove(id string, service RemoveService, l logger.Logger) Operation

Remove operation

func Update

func Update(payload interface{}, service UpdateService, mapper MapService, l logger.Logger) Operation

Update operation

type PayloadMapper

type PayloadMapper interface {
	PayloadToModel(interface{}) interface{}
}

PayloadMapper interface

type RemoveService

type RemoveService interface {
	Remove(context.Context, kernel.ID) error
}

RemoveService interface

type UpdateService

type UpdateService interface {
	Update(context.Context, interface{}) (interface{}, error)
}

UpdateService interface

Jump to

Keyboard shortcuts

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