restful

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrPageKey = "error"
)

Variables

View Source
var (
	Error404Set    = Error404()
	QuickReplySet  = QuickReply()
	NewPromHTTPSet = NewPromHTTP()
)
View Source
var ErrorPageTmpl = `` /* 3951-byte string literal not displayed */

Functions

func Error404

func Error404() gin.HandlerFunc

Error404 method

func NewGin

func NewGin(
	option config.Set,
	render *Render,
	guarder *JWTGuarder,
) (*gin.Engine, error)

func NewPromHTTP

func NewPromHTTP() gin.HandlerFunc

func QuickReply

func QuickReply() gin.HandlerFunc

QuickReply method

Types

type BasicGuardValidator

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

func NewBasicGuardValidator

func NewBasicGuardValidator(jwt jwtTool.IJWT) *BasicGuardValidator

func (*BasicGuardValidator) Verify

func (b *BasicGuardValidator) Verify(c *gin.Context, token string) error

type CommonHandler

type CommonHandler struct {
	Error404   gin.HandlerFunc
	QuickReply gin.HandlerFunc
	PromHTTP   gin.HandlerFunc
}

type ErrPage

type ErrPage struct {
	Title string
	Code  int
}

type GuarderValidator

type GuarderValidator interface {
	Verify(c *gin.Context, token string) error
}

type JWTGuarder

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

func NewJWTGuarder

func NewJWTGuarder(option config.JWT, validator GuarderValidator) *JWTGuarder

func (*JWTGuarder) JWTGuarder

func (j *JWTGuarder) JWTGuarder(whitelist ...string) gin.HandlerFunc

JWTGuarder method

type Render

type Render struct {
	Files        map[string][]string
	TemplatesDir string
	Layout       string
	Ext          string
	Debug        bool
	// contains filtered or unexported fields
}

Render implements gin's HTMLRender and provides some sugar on top of it

func NewRender

func NewRender() *Render

NewRender returns a fresh instance of Render

func (*Render) Add

func (r *Render) Add(name string, tmpl *template.Template) error

Add assigns the name to the template

func (*Render) Instance

func (r *Render) Instance(name string, data interface{}) render.Render

Instance implements gin's HTML render interface

Jump to

Keyboard shortcuts

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