Documentation ¶
Index ¶
- Constants
- func AuthWrapper(fn server.HandlerFunc) server.HandlerFunc
- func CreateDBSession(service string) (*mgo.Session, error)
- func Filter(v string) client.CallOption
- func GetMicroClient(service string, exOpts ...micro.Option) micro.Service
- func GetMicroServer(service string, exOpts ...micro.Option) micro.Service
- func GetMicroWeb(service string, exOpts ...web.Option) web.Service
- func GetUserClient() userPb.UserServiceClient
- func NewJaegerTracer(serviceName, addr string) (opentracing.Tracer, io.Closer, error)
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 ¶
CreateDBSession create the session of db
func GetMicroClient ¶
func GetMicroClient(service string, exOpts ...micro.Option) micro.Service
func GetMicroServer ¶
func GetMicroServer(service string, exOpts ...micro.Option) micro.Service
func GetUserClient ¶
func GetUserClient() userPb.UserServiceClient
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.