gin

package module
v0.0.0-...-159dada Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(router *gin.Engine, basePath string, handlers *gotrust.GenericAuthHandlers)

RegisterRoutes registers all auth routes on a Gin engine

func WrapHandler

func WrapHandler(handler gotrust.HTTPHandler) gin.HandlerFunc

WrapHandler converts a gotrust.HTTPHandler to gin.HandlerFunc

func WrapMiddleware

func WrapMiddleware(middleware gotrust.HTTPMiddleware) gin.HandlerFunc

WrapMiddleware converts a gotrust.HTTPMiddleware to gin.HandlerFunc

Types

type GinContext

type GinContext struct {
	*gin.Context
}

GinContext wraps gin.Context to implement gotrust.HTTPContext

func (*GinContext) Bind

func (g *GinContext) Bind(dest interface{}) error

Bind decodes request body

func (*GinContext) Context

func (g *GinContext) Context() context.Context

Context returns the request context

func (*GinContext) GetCookie

func (g *GinContext) GetCookie(name string) (*http.Cookie, error)

GetCookie gets a cookie

func (*GinContext) GetFormValue

func (g *GinContext) GetFormValue(key string) string

GetFormValue gets a form value

func (*GinContext) GetHeader

func (g *GinContext) GetHeader(key string) string

GetHeader gets a request header

func (*GinContext) GetQueryParam

func (g *GinContext) GetQueryParam(key string) string

GetQueryParam gets a query parameter

func (*GinContext) JSON

func (g *GinContext) JSON(code int, data interface{}) error

JSON sends a JSON response

func (*GinContext) Redirect

func (g *GinContext) Redirect(code int, url string) error

Redirect sends a redirect response

func (*GinContext) SetCookie

func (g *GinContext) SetCookie(cookie *http.Cookie)

SetCookie sets a cookie

func (*GinContext) SetHeader

func (g *GinContext) SetHeader(key, value string)

SetHeader sets a response header

func (*GinContext) SetStatus

func (g *GinContext) SetStatus(code int)

SetStatus sets the response status code

func (*GinContext) String

func (g *GinContext) String(code int, text string) error

String sends a text response

type GinRouter

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

GinRouter wraps gin.RouterGroup to implement gotrust.Router

func NewGinRouter

func NewGinRouter(group *gin.RouterGroup) *GinRouter

NewGinRouter creates a new Gin router wrapper

func (*GinRouter) DELETE

func (r *GinRouter) DELETE(path string, handler gotrust.HTTPHandler, middleware ...gotrust.HTTPMiddleware)

DELETE registers a DELETE route

func (*GinRouter) GET

func (r *GinRouter) GET(path string, handler gotrust.HTTPHandler, middleware ...gotrust.HTTPMiddleware)

GET registers a GET route

func (*GinRouter) Group

func (r *GinRouter) Group(prefix string, middleware ...gotrust.HTTPMiddleware) gotrust.Router

Group creates a new route group

func (*GinRouter) POST

func (r *GinRouter) POST(path string, handler gotrust.HTTPHandler, middleware ...gotrust.HTTPMiddleware)

POST registers a POST route

func (*GinRouter) PUT

func (r *GinRouter) PUT(path string, handler gotrust.HTTPHandler, middleware ...gotrust.HTTPMiddleware)

PUT registers a PUT route

Jump to

Keyboard shortcuts

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