handler

package
v0.0.0-...-033a009 Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPError

func NewHTTPError(code int, msg interface{}) error

NewHTTPError factory

func Router

func Router(h *Handler) http.Handler

Router returns http.Handler innterface

Types

type HTTPError

type HTTPError struct {
	Code    int         `json:"code"`
	Message interface{} `json:"message"`
}

HTTPError struct

func (HTTPError) Error

func (e HTTPError) Error() string

Implementation of the error interface

type Handler

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

Handler struct

func New

func New(db *sql.DB, q *repository.Queries, s *storage.Interactor, rf resizerFunc) *Handler

New is a factory function, returns a new instance of the HTTP handler interactor

func (*Handler) GetOriginalItem

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

GetOriginalItem http handler

func (*Handler) GetOriginalItemsList

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

GetOriginalItemsList http handler

func (*Handler) GetResizedItem

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

GetResizedItem http handler

func (*Handler) GetResizedItemsList

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

GetResizedItemsList http handler

func (*Handler) Resize

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

Resize an uploaded item according to passed parameters

func (*Handler) Upload

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

Upload new item and resize according to passed parameters

type ValidationError

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

ValidationError ...

func NewValidationError

func NewValidationError(errs url.Values) *ValidationError

NewValidationError factory

func (*ValidationError) Add

func (e *ValidationError) Add(key string, vals []string)

Add validation errors to errors bag

func (*ValidationError) Error

func (e *ValidationError) Error() string

Implementation of the error interface

func (*ValidationError) GetAll

func (e *ValidationError) GetAll() url.Values

GetAll validation errors

func (*ValidationError) Set

func (e *ValidationError) Set(errBag url.Values)

Set validation errors bag

type Wrap

type Wrap func(w http.ResponseWriter, r *http.Request) error

Wrap function makes a handler compatible with the default go mux interface

func (Wrap) ServeHTTP

func (h Wrap) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP func is http.Handler interface implementation

Jump to

Keyboard shortcuts

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