core

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetContext added in v1.3.0

func GetContext(c *gin.Context, name string) (interface{}, error)

GetContext get custom context

func GetRequest added in v1.3.0

func GetRequest(c *gin.Context) *req

GetRequest get request datatype from context

func GetSpan

func GetSpan(c *gin.Context) opentracing.Span

GetSpan get opentracing span from context

func SetContext added in v1.3.0

func SetContext(c *gin.Context, name string, val interface{})

SetContext set custom context

func StartSpanFormRpc added in v1.1.1

func StartSpanFormRpc(ctx context.Context, operateName string) opentracing.Span

StartSpanFormRpc start and get opentracing span from rpc call

func StartSpanFromHeader added in v1.1.1

func StartSpanFromHeader(header http.Header, operateName string) opentracing.Span

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 New added in v1.0.8

func New() *Garden

New create go-garden instance

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

func (g *Garden) GatewayRoute(r *gin.Engine)

GatewayRoute create gateway service type to use this

func (*Garden) Get added in v1.3.0

func (g *Garden) Get(name string) (interface{}, error)

Get instance by name

func (*Garden) GetCfg added in v1.3.0

func (g *Garden) GetCfg() cfg

func (*Garden) GetEtcd added in v1.3.0

func (g *Garden) GetEtcd() (*clientV3.Client, error)

GetEtcd instance to performing etcd operations

func (*Garden) GetServiceId added in v1.3.0

func (g *Garden) GetServiceId() string

GetServiceId get this service union id

func (*Garden) GetServiceIp added in v1.3.0

func (g *Garden) GetServiceIp() string

GetServiceIp get this service ip

func (*Garden) GetServices added in v1.3.0

func (g *Garden) GetServices() map[string]*service

GetServices get all cluster service map by etcdKey

func (*Garden) PushGateway added in v1.2.0

func (g *Garden) PushGateway(job string, data MapData) (string, error)

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

func (*Garden) Set added in v1.3.0

func (g *Garden) Set(name string, val interface{}) error

Set instance by name, not support default name like 'etcd'

func (*Garden) SetMetric added in v1.3.0

func (g *Garden) SetMetric(key string, val interface{})

SetMetric to prometheus collect

func (*Garden) StartRpcTrace added in v1.1.1

func (g *Garden) StartRpcTrace(ctx context.Context, args interface{}, method string) opentracing.Span

StartRpcTrace rpc method use this method first

type MapData

type MapData map[string]interface{}

MapData map like any value datatype

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
}

Directories

Path Synopsis
drives

Jump to

Keyboard shortcuts

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