http

package
v0.0.0-...-7d6f566 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2020 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBadRequestError

func CreateBadRequestError(message string) error

func CreateInternalError

func CreateInternalError() error

func CreateNotFoundError

func CreateNotFoundError() error

func CreateUnauthorizedError

func CreateUnauthorizedError() error

Types

type Context

type Context struct {
	Reader
	Writer
	Middleware
}

type Error

type Error struct {
	Code   int
	Reason string
}

func (Error) Error

func (e Error) Error() string

type Handler

type Handler func(ctx *Context)

type Json

type Json map[string]interface{}

type Middleware

type Middleware interface {
	NextHandler()

	IsAborted() bool

	AbortTransaction()

	AbortTransactionWithStatus(code int, jsonObj interface{})

	AbortTransactionWithError(err error)

	SetValue(key string, value interface{})

	GetValue(key string) interface{}
}

type PipelineContext

type PipelineContext interface {
	GetReader() (Reader, error)
	GetWriter() (Writer, error)
	GetMiddleware() (Middleware, error)
}

type Reader

type Reader interface {
	GetUrl() string

	GetMethod() string

	GetParameter(key string) string

	GetHeader(key string) string

	GetFormData(key string) (string, bool)

	ReadBody(obj interface{}) error
}

type Writer

type Writer interface {
	WriteJson(code int, obj interface{})

	WriteString(code int, format string, values ...interface{})

	WriteStatus(code int)
}

Jump to

Keyboard shortcuts

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