Documentation ¶
Index ¶
- func GetContext(c *gin.Context, name string) (interface{}, error)
- func GetRequest(c *gin.Context) *req
- func GetSpan(c *gin.Context) opentracing.Span
- func SetContext(c *gin.Context, name string, val interface{})
- func StartSpanFormRpc(ctx context.Context, operateName string) opentracing.Span
- func StartSpanFromHeader(header http.Header, operateName string) opentracing.Span
- func StartSpanFromTextMap(textMap opentracing.TextMapCarrier, operateName string) opentracing.Span
- type Garden
- func (g *Garden) CallRpc(span opentracing.Span, service, action string, args, reply interface{}) error
- func (g *Garden) CheckCallSafeMiddleware() gin.HandlerFunc
- func (g *Garden) FinishRpcTrace(span opentracing.Span)
- func (g *Garden) GatewayRoute(r *gin.Engine)
- func (g *Garden) Get(name string) (interface{}, error)
- func (g *Garden) GetCfg() cfg
- func (g *Garden) GetEtcd() (*clientV3.Client, error)
- func (g *Garden) GetServiceId() string
- func (g *Garden) GetServiceIp() string
- func (g *Garden) GetServices() map[string]*service
- func (g *Garden) PushGateway(job string, data MapData) (string, error)
- func (g *Garden) Run(route func(r *gin.Engine), rpc interface{}, auth func() gin.HandlerFunc)
- func (g *Garden) Set(name string, val interface{}) error
- func (g *Garden) SetMetric(key string, val interface{})
- func (g *Garden) StartRpcTrace(ctx context.Context, args interface{}, method string) opentracing.Span
- type MapData
- type Rpc
- type SyncRoutesArgs
- type SyncRoutesReply
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetContext ¶ added in v1.3.0
GetContext get custom context
func GetRequest ¶ added in v1.3.0
GetRequest get request datatype from context
func SetContext ¶ added in v1.3.0
SetContext set custom context
func StartSpanFormRpc ¶ added in v1.1.1
StartSpanFormRpc start and get opentracing span from rpc call
func StartSpanFromHeader ¶ added in v1.1.1
StartSpanFromHeader Get the opentracing span from the request header If no span, will create new root span, if any, new child span
func StartSpanFromTextMap ¶ added in v1.1.1
func StartSpanFromTextMap(textMap opentracing.TextMapCarrier, operateName string) opentracing.Span
StartSpanFromTextMap Get the opentracing span from textMap If no span, will create new root span, if any, new child span
Types ¶
type Garden ¶
type Garden struct {
// contains filtered or unexported fields
}
Garden go garden framework class
func (*Garden) CallRpc ¶ added in v1.1.5
func (g *Garden) CallRpc(span opentracing.Span, service, action string, args, reply interface{}) error
CallRpc call other service rpc method
func (*Garden) CheckCallSafeMiddleware ¶
func (g *Garden) CheckCallSafeMiddleware() gin.HandlerFunc
CheckCallSafeMiddleware from call service safe check
func (*Garden) FinishRpcTrace ¶ added in v1.1.1
func (g *Garden) FinishRpcTrace(span opentracing.Span)
FinishRpcTrace rpc method use this method last
func (*Garden) GatewayRoute ¶
GatewayRoute create gateway service type to use this
func (*Garden) GetServiceId ¶ added in v1.3.0
GetServiceId get this service union id
func (*Garden) GetServiceIp ¶ added in v1.3.0
GetServiceIp get this service ip
func (*Garden) GetServices ¶ added in v1.3.0
GetServices get all cluster service map by etcdKey
func (*Garden) PushGateway ¶ added in v1.2.0
PushGateway upload metric to pushGateway
func (*Garden) Run ¶
func (g *Garden) Run(route func(r *gin.Engine), rpc interface{}, auth func() gin.HandlerFunc)
Run service start
type Rpc ¶ added in v1.1.1
type Rpc int
func (*Rpc) SyncRoutes ¶ added in v1.1.1
func (r *Rpc) SyncRoutes(ctx context.Context, args *SyncRoutesArgs, reply *SyncRoutesReply) error
SyncRoutes sync routes.yml method
type SyncRoutesArgs ¶ added in v1.1.1
type SyncRoutesArgs struct {
Yml []byte
}
type SyncRoutesReply ¶ added in v1.1.1
type SyncRoutesReply struct {
Result bool
}