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