handler

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fetch

func Fetch(g *gin.Engine)

func Incidents

func Incidents(g *gin.Engine)

func Init

func Init(c *gin.Context)

func New

func New() *gin.Engine

func Root

func Root(g *gin.Engine)

func SetLimit added in v0.0.5

func SetLimit(c *gin.Context)
Example
package main

import (
	"fmt"
	"net/http/httptest"

	"github.com/gin-gonic/gin"
	"github.com/itsubaki/fourkeys/handler"
)

func main() {
	gin.SetMode(gin.ReleaseMode)

	req := httptest.NewRequest("GET", "/_test?limit=999", nil)

	c, _ := gin.CreateTestContext(httptest.NewRecorder())
	c.Request = req
	handler.SetLimit(c)

	fmt.Println(c.GetString("limit"))

}
Output:

999

func SetTraceID

func SetTraceID(c *gin.Context)
Example
package main

import (
	"fmt"
	"math/rand"
	"net/http/httptest"

	"github.com/gin-gonic/gin"
	"github.com/itsubaki/fourkeys/handler"
)

func main() {
	gin.SetMode(gin.ReleaseMode)

	req := httptest.NewRequest("GET", "/", nil)
	value := fmt.Sprintf("%016x%016x/%d;o=1", rand.Int63(), rand.Int63(), rand.Int63())
	req.Header.Add("X-Cloud-Trace-Context", value)

	c, _ := gin.CreateTestContext(httptest.NewRecorder())
	c.Request = req
	handler.SetTraceID(c)

	fmt.Println(c.GetBool("trace_true"))

}
Output:

true

func Status

func Status(g *gin.Engine)

func UsePProf

func UsePProf(g *gin.Engine)

Types

This section is empty.

Directories

Path Synopsis
actions

Jump to

Keyboard shortcuts

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