endpoint

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRandomBytes

func GenerateRandomBytes(n int) ([]byte, error)

GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GenerateRandomString

func GenerateRandomString(n int) (string, error)

GenerateRandomString returns a securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func WithFormRequestParser

func WithFormRequestParser(ctx context.Context, r *http.Request, i interface{}) error

func WithJsonRequestParser

func WithJsonRequestParser(ctx context.Context, r *http.Request, i interface{}) error

func WithJsonResponseWriter

func WithJsonResponseWriter(ctx context.Context, w http.ResponseWriter, i interface{}) error

func WithRequestQueryParser

func WithRequestQueryParser(ctx context.Context, r *http.Request, i interface{}) error

func WithRequestValidation

func WithRequestValidation(ctx context.Context, i interface{}) error

func WithResponseValidation

func WithResponseValidation(ctx context.Context, i interface{}) error

func WithResponseWriter

func WithResponseWriter(ctx context.Context, w http.ResponseWriter, tp string, i interface{}) error

func WithYamlResponseWriter

func WithYamlResponseWriter(ctx context.Context, w http.ResponseWriter, i interface{}) error

Types

type Endpoint

type Endpoint struct {
	EndpointHandler
	// contains filtered or unexported fields
}

func (Endpoint) Middleware

func (ep Endpoint) Middleware() []middleware.MiddlewareHandler

func (*Endpoint) Setup

func (ep *Endpoint) Setup(options ...EndpointOption)

func (Endpoint) Specification

func (ep Endpoint) Specification() api.Path

type EndpointHandler

type EndpointHandler interface {
	http.Handler
	Specification() api.Path
	Middleware() []middleware.MiddlewareHandler
}

type EndpointOption

type EndpointOption func(e *Endpoint)

func WithMiddleware

func WithMiddleware(handlers ...middleware.MiddlewareHandler) EndpointOption

func WithSpecification

func WithSpecification(spec api.Path) EndpointOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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