cat

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

README

gin-cat

gin cat middleware

base on https://github.com/cat-go/cat

package main
import (
	"github.com/gin-gonic/gin"
	catmidd "github.com/ainiaa/gin-cat"
)
func initGin(c *catmidd.Conf) *gin.Engine {
    r := gin.New()
    r.Use(catmidd.Cat(true, c))
    
    return r
}

func main() {
    c := &catmidd.Conf{
        Flag:true,
        AppId:"gin-cat",
        Port:2280,
        HttpPort:8080,
        ServerAddr:"127.0.0.1",
        IsDebug:true,
    }
    
    initGin(c)
    
   // shutdown cat
   // catmidd.Shutdown(c)     
}

Documentation

Index

Constants

View Source
const (
	CatCtx          = "cat_ctx"
	CatCtxRootTran  = "cat_root_tran"
	CatCtxRedisTran = "cat_redis_tran"
	CatCtxMysqlTran = "cat_mysql_tran"

	TypeHttpRemote    = "HttpRemoteCall"
	TypeMongoDbPrefix = "MongoDb."
	TypeUrlStatus     = "URL.status"

	RemoteCallMethod = "RemoteCall.Method"
	RemoteCallErr    = "RemoteCall.Err"
	RemoteCallStatus = "RemoteCall.Status"
	RemoteCallScheme = "RemoteCall.Scheme"
)

Variables

This section is empty.

Functions

func Cat

func Cat(init bool, c *Conf) gin.HandlerFunc

监控与链路追踪

func InitCat

func InitCat(c *Conf)

func Shutdown

func Shutdown(c *Conf)

Types

type Conf

type Conf struct {
	Flag       bool   `json:"flag"`
	AppId      string `json:"app_id"`
	Port       int    `json:"port"`
	HttpPort   int    `json:"http_port"`
	ServerAddr string `json:"server_addr"`
	IsDebug    bool   `json:"is_debug"`
}

Jump to

Keyboard shortcuts

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