rest

package
v0.0.0-...-de70ca6 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 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 Formatter

type Formatter interface {
	Marshal(interface{}) ([]byte, error)
}

Formatter will convert the supplied object to bytes

type GetConfig

type GetConfig interface {
	Logger() Logger
}

GetConfig is the config for the Get Handler

type GetHandler

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

GetHandler is the HTTP handler for the "Get Person" endpoint

func NewGetHandler

func NewGetHandler(cfg GetConfig, model GetModel, formatter Formatter) *GetHandler

NewGetHandler is the constructor for GetHandler

func (*GetHandler) ServeHTTP

func (h *GetHandler) ServeHTTP(response http.ResponseWriter, request *http.Request)

ServeHTTP implements http.Handler

type GetModel

type GetModel interface {
	Do(ID int) (*Person, error)
}

GetModel will load a registration

type Logger

type Logger interface {
	Debug(message string, args ...interface{})
	Info(message string, args ...interface{})
	Warn(message string, args ...interface{})
	Error(message string, args ...interface{})
}

type Person

type Person struct {
	ID       int
	FullName string
	Phone    string
	Currency string
	Price    float64
}

Jump to

Keyboard shortcuts

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