Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Latest commit

 

History

History
executable file
·
50 lines (36 loc) · 1.59 KB

README.md

File metadata and controls

executable file
·
50 lines (36 loc) · 1.59 KB

requestid

GoDoc Go.Dev reference codecov Action Status Go Report Card Licence Tag

requestid is an requestId(traceId) middleware for Gin

Format

`hostname-pid-initrandvalue-sequence`

Installation

    go get github.com/things-go/requestid

Simple Example

package main

import (
	"fmt"

	"github.com/gin-gonic/gin"

	"github.com/things-go/requestid"
)

func main() {
	router := gin.New()
	router.Use(requestid.RequestId())
	router.GET("/", func(c *gin.Context) {
		fmt.Println(requestid.FromRequestId(c.Request.Context()))
		fmt.Println(requestid.GetRequestId(c))
	})
	router.Run(":8080")
}

License

This project is under MIT License. See the LICENSE file for the full license text.