gnext

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2022 License: MIT Imports: 15 Imported by: 0

README

gNext Web Framework


Go Report Card GoDoc Release

gNext is a brilliant Gin Web Framework extension. Offers the API structuring, automates validation and generates documentation. It's fully compatible with the existing Gin handlers and Gin's middlewares.


Let's have a look at a base example.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultErrorHandler added in v0.2.0

func DefaultErrorHandler(err error) (status Status, response *DefaultErrorResponse)

Types

type Body

type Body struct{}

func (Body) BodyDocs

func (m Body) BodyDocs()

type BodyInterface

type BodyInterface interface {
	BodyDocs()
}

type DefaultErrorResponse added in v0.2.0

type DefaultErrorResponse struct {
	ErrorResponse `status_codes:"4XX,5XX"`
	Message       string   `json:"message"`
	Details       []string `json:"details"`
	Success       bool     `json:"success"`
}

type ErrorHandlerCaller added in v0.2.0

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

func WrapErrorHandler added in v0.2.0

func WrapErrorHandler(handler interface{}) *ErrorHandlerCaller

type ErrorInterface

type ErrorInterface interface {
	ErrorDocs()
}

type ErrorResponse added in v0.2.0

type ErrorResponse struct{}

func (ErrorResponse) ErrorDocs added in v0.2.0

func (m ErrorResponse) ErrorDocs()

type HandlerCaller

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

func NewHandlerCaller

func NewHandlerCaller(receiver reflect.Value) *HandlerCaller

type HandlerPanicked added in v0.2.0

type HandlerPanicked struct {
	Value      interface{}
	StackTrace []byte
}

func (*HandlerPanicked) Error added in v0.2.0

func (e *HandlerPanicked) Error() string

type HandlerWrapper

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

func WrapHandler

func WrapHandler(method string, path string, middlewares []Middleware, documentation *docs.Docs, handler, errorHandler interface{}, doc ...*docs.PathDoc) *HandlerWrapper

type Headers

type Headers http.Header

func (Headers) HeadersDocs

func (m Headers) HeadersDocs()

type HeadersInterface

type HeadersInterface interface {
	HeadersDocs()
}

type IRouter

type IRouter interface {
	IRoutes
	RawRouter() gin.IRouter
	Group(string, ...*docs.PathDoc) IRouter
	OnError(handler interface{}) IRoutes
}

type IRoutes

type IRoutes interface {
	Use(Middleware) IRoutes

	Handle(string, string, interface{}, ...*docs.PathDoc) IRoutes
	Any(string, interface{}, ...*docs.PathDoc) IRoutes
	GET(string, interface{}, ...*docs.PathDoc) IRoutes
	POST(string, interface{}, ...*docs.PathDoc) IRoutes
	DELETE(string, interface{}, ...*docs.PathDoc) IRoutes
	PATCH(string, interface{}, ...*docs.PathDoc) IRoutes
	PUT(string, interface{}, ...*docs.PathDoc) IRoutes
	OPTIONS(string, interface{}, ...*docs.PathDoc) IRoutes
	HEAD(string, interface{}, ...*docs.PathDoc) IRoutes
}

type Middleware

type Middleware struct {
	Before interface{}
	After  interface{}
}

type MiddlewareFactory

type MiddlewareFactory func() Middleware

type NotFound

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

type Query

type Query struct{}

func (Query) QueryDocs

func (m Query) QueryDocs()

type QueryInterface

type QueryInterface interface {
	QueryDocs()
}

type Response

type Response struct{}

func (Response) ResponseDocs

func (m Response) ResponseDocs()

type ResponseInterface

type ResponseInterface interface {
	ResponseDocs()
}

type RootRouter added in v0.2.0

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

func DocumentedRouter added in v0.2.0

func DocumentedRouter(documentation *docs.Docs) *RootRouter

func Router

func Router() *RootRouter

func (*RootRouter) Any added in v0.2.0

func (g *RootRouter) Any(path string, handler interface{}, doc ...*docs.PathDoc) IRoutes

func (*RootRouter) DELETE added in v0.2.0

func (g *RootRouter) DELETE(path string, handler interface{}, doc ...*docs.PathDoc) IRoutes

func (*RootRouter) Engine added in v0.2.0

func (r *RootRouter) Engine() http.Handler

func (*RootRouter) GET added in v0.2.0

func (g *RootRouter) GET(path string, handler interface{}, doc ...*docs.PathDoc) IRoutes

func (*RootRouter) Group added in v0.2.0

func (g *RootRouter) Group(prefix string, _ ...*docs.PathDoc) IRouter

func (*RootRouter) HEAD added in v0.2.0

func (g *RootRouter) HEAD(path string, handler interface{}, doc ...*docs.PathDoc) IRoutes

func (*RootRouter) Handle added in v0.2.0

func (g *RootRouter) Handle(method string, path string, handler interface{}, doc ...*docs.PathDoc) IRoutes

func (*RootRouter) OPTIONS added in v0.2.0

func (g *RootRouter) OPTIONS(path string, handler interface{}, doc ...*docs.PathDoc) IRoutes

func (*RootRouter) OnError added in v0.2.0

func (g *RootRouter) OnError(errorHandler interface{}) IRoutes

func (*RootRouter) PATCH added in v0.2.0

func (g *RootRouter) PATCH(path string, handler interface{}, doc ...*docs.PathDoc) IRoutes

func (*RootRouter) POST added in v0.2.0

func (g *RootRouter) POST(path string, handler interface{}, doc ...*docs.PathDoc) IRoutes

func (*RootRouter) PUT added in v0.2.0

func (g *RootRouter) PUT(path string, handler interface{}, doc ...*docs.PathDoc) IRoutes

func (*RootRouter) RawRouter added in v0.2.0

func (g *RootRouter) RawRouter() gin.IRouter

func (*RootRouter) Run added in v0.2.0

func (r *RootRouter) Run(addr string) error

func (*RootRouter) Use added in v0.2.0

func (g *RootRouter) Use(middleware Middleware) IRoutes

type Status

type Status int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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