gitee.com/quant1x/gox@v1.7.6/mdc/mdc.go (about)

     1  package mdc
     2  
     3  import (
     4  	"gitee.com/quant1x/gox/gls"
     5  	"gitee.com/quant1x/gox/util/uuid"
     6  	//uuid "github.com/satori/go.uuid"
     7  )
     8  
     9  const (
    10  	APP_TRACEID = "app-traceid"
    11  )
    12  
    13  func init() {
    14  	GenTraceId()
    15  }
    16  
    17  func GenTraceId() {
    18  	u1 := uuid.NewV4()
    19  	Set(APP_TRACEID, u1.String())
    20  }
    21  
    22  func RemoveTraceId() {
    23  	Remove(APP_TRACEID)
    24  }
    25  
    26  func Set(key string, value interface{}) {
    27  	gls.Set(key, value)
    28  }
    29  
    30  func Get(key string) interface{} {
    31  	return gls.Get(key)
    32  }
    33  
    34  func Remove(key string) {
    35  	gls.Remove(key)
    36  }