router

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	*gin.Context
}

func (*Context) Abort

func (c *Context) Abort(err Error)

func (*Context) AbortWithError

func (c *Context) AbortWithError(statusCode int, err Error)

func (*Context) BadRequest

func (c *Context) BadRequest(err Error)

func (*Context) Conflict

func (c *Context) Conflict(err Error)

func (*Context) JSON

func (c *Context) JSON(data interface{})

func (*Context) NotFound

func (c *Context) NotFound(err Error)

func (*Context) OK

func (c *Context) OK()

func (*Context) ParseBody

func (c *Context) ParseBody(obj interface{}) error

type ErrCode

type ErrCode string
const (
	ErrFailedToParseBody ErrCode = "failed_to_parse_body"
)

type Error

type Error struct {
	Code           ErrCode `json:"code"`
	PublicMessage  string  `json:"message,omitempty"`
	PrivateMessage string  `json:"-"`
}

func (Error) Error

func (e Error) Error() string

type Group

type Group struct {
	*gin.RouterGroup
}

func (*Group) Any

func (g *Group) Any(path string, handlers ...HandlerFunc)

func (*Group) DELETE

func (g *Group) DELETE(path string, handlers ...HandlerFunc)

func (*Group) GET

func (g *Group) GET(path string, handlers ...HandlerFunc)

func (*Group) Group

func (g *Group) Group(path string, handlers ...HandlerFunc) *Group

func (*Group) HEAD

func (g *Group) HEAD(path string, handlers ...HandlerFunc)

func (*Group) OPTIONS

func (g *Group) OPTIONS(path string, handlers ...HandlerFunc)

func (*Group) PATCH

func (g *Group) PATCH(path string, handlers ...HandlerFunc)

func (*Group) POST

func (g *Group) POST(path string, handlers ...HandlerFunc)

func (*Group) PUT

func (g *Group) PUT(path string, handlers ...HandlerFunc)

type HandlerFunc

type HandlerFunc func(*Context)

type Router

type Router struct {
	*gin.Engine
	// contains filtered or unexported fields
}

func New

func New() *Router

func (*Router) Any

func (r *Router) Any(path string, handlers ...HandlerFunc)

func (*Router) DELETE

func (r *Router) DELETE(path string, handlers ...HandlerFunc)

func (*Router) GET

func (r *Router) GET(path string, handlers ...HandlerFunc)

func (*Router) Group

func (r *Router) Group(path string, handlers ...HandlerFunc) *Group

func (*Router) HEAD

func (r *Router) HEAD(path string, handlers ...HandlerFunc)

func (*Router) OPTIONS

func (r *Router) OPTIONS(path string, handlers ...HandlerFunc)

func (*Router) PATCH

func (r *Router) PATCH(path string, handlers ...HandlerFunc)

func (*Router) POST

func (r *Router) POST(path string, handlers ...HandlerFunc)

func (*Router) PUT

func (r *Router) PUT(path string, handlers ...HandlerFunc)

func (*Router) Start

func (r *Router) Start(addr string) error

func (*Router) Stop

func (r *Router) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

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