moleculer-go / moleculer

🚀 Progressive microservices framework for Go - based and compatible with https://github.com/moleculerjs/moleculer
MIT License
144 stars 27 forks source link

[question] Is possible to get request Context in struct method #85

Closed nnqq closed 4 years ago

nnqq commented 4 years ago

Hi

When creating services as a Struct, is it possible to get moleculer.Context of request in handler? https://github.com/moleculer-go/moleculer/blob/18a249e61c6b79d3b7d437ad8457fb02eb4f9597/examples/math2/math.service.go#L17

vpashka commented 4 years ago

For example, you can declare a service through a ServiceSchema (or call your function in this place passing context to it)

https://github.com/moleculer-go/moleculer/blob/18a249e61c6b79d3b7d437ad8457fb02eb4f9597/examples/standalone/math.service.go#L16