Documentation ¶
Index ¶
- func ScaffoldContextHelper(context any, ctx *ScaffoldContext, ...) micro.Handler
- type ScaffoldContext
- type ScaffoldTask
- type ServiceScaffold
- func (s *ServiceScaffold) AddHandler(context any, subject string, ...) error
- func (s *ServiceScaffold) AddRepeatTask(context any, interval string, ...) error
- func (s *ServiceScaffold) Init(serviceName string, version string, description string) (*ServiceScaffold, error)
- func (s *ServiceScaffold) IsRunning() bool
- func (s *ServiceScaffold) SendMessage(subject string, data any) error
- func (s *ServiceScaffold) SendRequest(subject string, data any, result any) error
- func (s *ServiceScaffold) ServiceID() string
- func (s *ServiceScaffold) Start() error
- func (s *ServiceScaffold) Stop() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ScaffoldContextHelper ¶
func ScaffoldContextHelper(context any, ctx *ScaffoldContext, handler func(any, *ScaffoldContext, micro.Request)) micro.Handler
Types ¶
type ScaffoldContext ¶
func (*ScaffoldContext) DecodeRequest ¶
func (s *ScaffoldContext) DecodeRequest(req micro.Request, result any) error
DecodeRequest convenience function for decoding structure data
func (*ScaffoldContext) Init ¶
func (s *ScaffoldContext) Init(nats *mq.Nats, serviceInfo micro.Info) *ScaffoldContext
Init create the scaffold context
func (*ScaffoldContext) PublishError ¶
func (s *ScaffoldContext) PublishError(req micro.Request, err error)
PublishError convenience function to publish errors
type ScaffoldTask ¶
type ServiceScaffold ¶
type ServiceScaffold struct {
// contains filtered or unexported fields
}
func (*ServiceScaffold) AddHandler ¶
func (s *ServiceScaffold) AddHandler(context any, subject string, handler func(context any, scaffoldContext *ScaffoldContext, request micro.Request)) error
AddHandler adds the new handler to the scaff
func (*ServiceScaffold) AddRepeatTask ¶
func (s *ServiceScaffold) AddRepeatTask(context any, interval string, taskHandler func(context any, scaffoldContext *ScaffoldContext)) error
AddRepeatTask adds a task that is routinely called at specified duration interval is a specific time string ex. 30s 1m 5m 1h
func (*ServiceScaffold) Init ¶
func (s *ServiceScaffold) Init(serviceName string, version string, description string) (*ServiceScaffold, error)
Init create a service scaffold
func (*ServiceScaffold) IsRunning ¶
func (s *ServiceScaffold) IsRunning() bool
func (*ServiceScaffold) SendMessage ¶
func (s *ServiceScaffold) SendMessage(subject string, data any) error
func (*ServiceScaffold) SendRequest ¶
func (s *ServiceScaffold) SendRequest(subject string, data any, result any) error
func (*ServiceScaffold) ServiceID ¶
func (s *ServiceScaffold) ServiceID() string
func (*ServiceScaffold) Start ¶
func (s *ServiceScaffold) Start() error
Start the service with a context, Note: context can be any structure or data for use by the handlers
func (*ServiceScaffold) Stop ¶
func (s *ServiceScaffold) Stop() error
Click to show internal directories.
Click to hide internal directories.