common

package
v0.0.0-...-54bb499 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2019 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_HOST          = "127.0.0.1"
	DEFAULT_Port          = 27017
	DEFAULT_DB            = "mongodb"
	DEFAULT_Admin_DB_Name = "admin"
)

Variables

This section is empty.

Functions

func AuthWrapper

func AuthWrapper(fn server.HandlerFunc) server.HandlerFunc
AuthWrapper 是一个高阶函数,入参是 "下一步" 函数,出参是认证函数

在返回的函数内部处理完认证逻辑后,再手动调用 fn() 进行下一步处理 token 是从 上下文中取出的,再调用 user-service 将其做验证 认证通过则 fn() 继续执行,否则报错

func CreateDBSession

func CreateDBSession(service string) (*mgo.Session, error)

CreateDBSession create the session of db

func Filter

func Filter(v string) client.CallOption

Filter will filter the version of the service

func GetMicroClient

func GetMicroClient(service string, exOpts ...micro.Option) micro.Service

func GetMicroServer

func GetMicroServer(service string, exOpts ...micro.Option) micro.Service

func GetMicroWeb

func GetMicroWeb(service string, exOpts ...web.Option) web.Service

func GetUserClient

func GetUserClient() userPb.UserServiceClient

func NewJaegerTracer

func NewJaegerTracer(serviceName, addr string) (opentracing.Tracer, io.Closer, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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