ginutil

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cookie(c *gin.Context, name, value string, maxAge int)

Cookie

func FoundRedirect

func FoundRedirect(c *gin.Context, location string)

FoundRedirect redirect with the StatusFound

func GetOrigin

func GetOrigin(c *gin.Context) string

func JSON

func JSON(c *gin.Context)

JSON

func JSONBadRequest

func JSONBadRequest(c *gin.Context, err error)

BadRequest

func JSONData

func JSONData(c *gin.Context, data interface{})

JSONData

func JSONError

func JSONError(c *gin.Context, status int, err error)

JSONError

func JSONForbidden

func JSONForbidden(c *gin.Context, err error)

Forbidden

func JSONList

func JSONList(c *gin.Context, list interface{}, total int64)

JSONList

func JSONServerError

func JSONServerError(c *gin.Context, err error)

ServerError

func JSONUnauthorized

func JSONUnauthorized(c *gin.Context, err error)

Unauthorized

func MovedRedirect

func MovedRedirect(c *gin.Context, location string)

MovedRedirect redirect with the StatusMovedPermanently

func ParamInt

func ParamInt(c *gin.Context, name string) int

func ParamInt64

func ParamInt64(c *gin.Context, name string) int64

func QueryInt

func QueryInt(c *gin.Context, name string) int

func QueryInt64

func QueryInt64(c *gin.Context, name string) int64

func SetupEmbedAssets

func SetupEmbedAssets(rg *gin.RouterGroup, fs http.FileSystem, relativePaths ...string)

func SetupPing

func SetupPing(e *gin.Engine)

func SetupResource

func SetupResource(rg *gin.RouterGroup, resources ...Resource)

func SetupStaticAssets

func SetupStaticAssets(rg *gin.RouterGroup, dir string)

func SetupSwagger

func SetupSwagger(engine *gin.Engine)

func Startup

func Startup(e *gin.Engine, addr string)

func TemporaryRedirect

func TemporaryRedirect(c *gin.Context, location string)

TemporaryRedirect redirect with the StatusTemporaryRedirect

Types

type Resource

type Resource interface {
	Register(router *gin.RouterGroup)
}

type SRI

type SRI struct {
	Pattern  string
	Handlers gin.HandlersChain
}

type Server

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

func NewServer

func NewServer(addr string) *Server

func (*Server) Run

func (s *Server) Run()

func (*Server) Start

func (s *Server) Start()

func (*Server) Stop

func (s *Server) Stop()

type SimpleRouter

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

func NewSimpleRouter

func NewSimpleRouter() *SimpleRouter

func (*SimpleRouter) Handler

func (si *SimpleRouter) Handler(c *gin.Context)

func (*SimpleRouter) Route

func (si *SimpleRouter) Route(relativePath string, handlerFunc ...gin.HandlerFunc)

func (*SimpleRouter) StaticFsIndex

func (si *SimpleRouter) StaticFsIndex(pattern string, fs http.FileSystem)

func (*SimpleRouter) StaticIndex

func (si *SimpleRouter) StaticIndex(pattern, dir string)

Jump to

Keyboard shortcuts

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