Add comments

This commit is contained in:
Asim 2016-06-19 16:02:14 +01:00
parent 30e0fef615
commit 5b381f13f0

View File

@ -46,15 +46,18 @@ var (
HeaderPrefix = "X-Micro-"
)
// NewService creates an returns a new Service based on the packages within.
func NewService(opts ...Option) Service {
return newService(opts...)
}
// FromContext retrieves a Service from the Context.
func FromContext(ctx context.Context) (Service, bool) {
s, ok := ctx.Value(serviceKey{}).(Service)
return s, ok
}
// NewContext returns a new Context with the Service embedded within it.
func NewContext(ctx context.Context, s Service) context.Context {
return context.WithValue(ctx, serviceKey{}, s)
}