Documentation ¶
Index ¶
- func NewContext(ctx context.Context, s Service) context.Context
- type Option
- func AfterStart(fn func() error) Option
- func AfterStop(fn func() error) Option
- func BeforeStart(fn func() error) Option
- func BeforeStop(fn func() error) Option
- func Cache(c cache.Cache) Option
- func Logger(l logger.Log) Option
- func Metadata(m map[string]string) Option
- func Name(s string) Option
- func Queue(q queue.Queue) Option
- func Server(s server.Server) Option
- func Stats(s stats.Stats) Option
- func Store(s store.Store) Option
- func Tracer(t trace.Tracer) Option
- type Options
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(options *Options)
func BeforeStart ¶
BeforeStart run funcs before service starts
type Options ¶
type Options struct { Name string Metadata map[string]string Config config.Config Logger logger.Log Tracer trace.Tracer Stats stats.Stats Server server.Server Queue queue.Queue Store store.Store Cache cache.Cache BeforeStart []func() error BeforeStop []func() error AfterStart []func() error AfterStop []func() error Context context.Context }
type Service ¶
type Service interface { // The service name Name() string // Init initialises options Init(...Option) error Options() Options Server() server.Server // Run the service Run() error String() string }
Service is a convenience of initialising services.
func FromContext ¶
FromContext retrieves a Service from the Context.
func NewService ¶
Click to show internal directories.
Click to hide internal directories.