entity_request_controller

package
v0.0.0-...-e06ca6e Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EntityRequestController

type EntityRequestController[e any] struct {
	// contains filtered or unexported fields
}

func NewEntityRequestController

func NewEntityRequestController[e any](responseHandler ResponseHandler, entityService EntityService[e]) *EntityRequestController[e]

func (*EntityRequestController[e]) HandleCreateEntityRequest

func (h *EntityRequestController[e]) HandleCreateEntityRequest(w http.ResponseWriter, r *http.Request)

func (*EntityRequestController[e]) HandleDeleteEntityByIdRequest

func (h *EntityRequestController[e]) HandleDeleteEntityByIdRequest(w http.ResponseWriter, r *http.Request)

func (*EntityRequestController[e]) HandleGetAllEntitiesRequest

func (h *EntityRequestController[e]) HandleGetAllEntitiesRequest(w http.ResponseWriter, r *http.Request)

func (*EntityRequestController[e]) HandleGetEntityByIdRequest

func (h *EntityRequestController[e]) HandleGetEntityByIdRequest(w http.ResponseWriter, r *http.Request)

func (*EntityRequestController[e]) HandleUpdateEntityRequest

func (h *EntityRequestController[e]) HandleUpdateEntityRequest(w http.ResponseWriter, r *http.Request)

type EntityService

type EntityService[e any] interface {
	GetAll() ([]*e, error)
	GetById(id uint) (*e, error)
	Create(entity *e) (*e, error)
	Update(entity *e) (*e, error)
	Delete(id uint) error
}

type ResponseHandler

type ResponseHandler interface {
	HandleResponseObject(w http.ResponseWriter, response interface{}, err error)
}

Jump to

Keyboard shortcuts

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