Documentation
¶
Index ¶
- func DefaultValue(s, v string) string
- func Fetch(g *gin.Engine)
- func Incidents(g *gin.Engine)
- func Init(c *gin.Context)
- func New() *gin.Engine
- func Root(g *gin.Engine)
- func SetDatasetName(c *gin.Context)
- func SetLimit(c *gin.Context)
- func SetTraceID(c *gin.Context)
- func Status(g *gin.Engine)
- func UsePProf(g *gin.Engine)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultValue ¶ added in v0.0.5
Example ¶
package main
import (
"fmt"
"github.com/itsubaki/fourkeys/handler"
)
func main() {
fmt.Println(handler.DefaultValue("foo", "bar"))
fmt.Println(handler.DefaultValue("", "bar"))
}
Output: foo bar
func SetDatasetName ¶
func SetTraceID ¶
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)
c, _ := gin.CreateTestContext(httptest.NewRecorder())
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.Request = req
handler.SetTraceID(c)
fmt.Println(c.GetBool("trace_true"))
}
Output: true
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.