service

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JoinVersionToName

func JoinVersionToName(name string, version string) string

func MergeSettings

func MergeSettings(settings ...map[string]interface{}) map[string]interface{}

func ParseVersion

func ParseVersion(iver interface{}) string

Types

type Action

type Action struct {
	// contains filtered or unexported fields
}

func CreateServiceAction

func CreateServiceAction(serviceName string, actionName string, handler moleculer.ActionHandler, params moleculer.ActionSchema) Action

func (*Action) FullName

func (serviceAction *Action) FullName() string

func (*Action) Handler

func (serviceAction *Action) Handler() moleculer.ActionHandler

func (*Action) Name

func (serviceAction *Action) Name() string

type Event

type Event struct {
	// contains filtered or unexported fields
}

func CreateServiceEvent

func CreateServiceEvent(eventName, serviceName, group string, handler moleculer.EventHandler) Event

func (*Event) Group

func (event *Event) Group() string

func (*Event) Handler

func (event *Event) Handler() moleculer.EventHandler

func (*Event) Name

func (event *Event) Name() string

func (*Event) ServiceName

func (event *Event) ServiceName() string

type HasCreated

type HasCreated interface {
	Created(moleculer.ServiceSchema, *log.Entry)
}

type HasCreatedNoParams

type HasCreatedNoParams interface {
	Created()
}

type HasDependencies

type HasDependencies interface {
	Dependencies() []string
}

type HasEvents

type HasEvents interface {
	Events() []moleculer.Event
}

type HasMetadata

type HasMetadata interface {
	Metadata() map[string]interface{}
}

type HasMixins

type HasMixins interface {
	Mixins() []moleculer.Mixin
}

type HasName

type HasName interface {
	Name() string
}

type HasSettings

type HasSettings interface {
	Settings() map[string]interface{}
}

type HasStarted

type HasStarted interface {
	Started(moleculer.BrokerContext, moleculer.ServiceSchema)
}

type HasStartedNoParams

type HasStartedNoParams interface {
	Started()
}

type HasStopped

type HasStopped interface {
	Stopped(moleculer.BrokerContext, moleculer.ServiceSchema)
}

type HasStoppedNoParams

type HasStoppedNoParams interface {
	Stopped()
}

type HasVersion

type HasVersion interface {
	Version() string
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func CreateServiceFromMap

func CreateServiceFromMap(serviceInfo map[string]interface{}) *Service

func FromObject

func FromObject(obj interface{}, bkr *moleculer.BrokerDelegates) (*Service, error)

FromObject creates a service based on an object.

func FromSchema

func FromSchema(schema moleculer.ServiceSchema, bkr *moleculer.BrokerDelegates) *Service

func (*Service) Actions

func (service *Service) Actions() []Action

func (*Service) AddActionMap

func (service *Service) AddActionMap(actionInfo map[string]interface{}) *Action

func (*Service) AddEventMap

func (service *Service) AddEventMap(eventInfo map[string]interface{}) *Event

func (*Service) AddMetadata

func (service *Service) AddMetadata(metadata map[string]interface{})

AddMetadata add metadata to the service. it will be merged with existing service metadata.

func (*Service) AddSettings

func (service *Service) AddSettings(settings map[string]interface{})

AddSettings add settings to the service. it will be merged with the existing service settings

func (*Service) AsMap

func (service *Service) AsMap() map[string]interface{}

AsMap export the service info in a map containing: name, version, settings, metadata, nodeID, actions and events. The events list does not contain internal events (events that starts with $) like $node.disconnected.

func (*Service) Dependencies

func (service *Service) Dependencies() []string

func (*Service) Events

func (service *Service) Events() []Event

func (*Service) FullName

func (service *Service) FullName() string

func (*Service) Name

func (service *Service) Name() string

func (*Service) NodeID

func (service *Service) NodeID() string

func (*Service) RemoveAction

func (service *Service) RemoveAction(fullname string)

func (*Service) RemoveEvent

func (service *Service) RemoveEvent(name string)

func (*Service) Schema

func (service *Service) Schema() *moleculer.ServiceSchema

func (*Service) SetNodeID

func (service *Service) SetNodeID(nodeID string)

func (*Service) Settings

func (service *Service) Settings() map[string]interface{}

func (*Service) Start

func (service *Service) Start(context moleculer.BrokerContext)

Start called by the broker when the service is starting.

func (*Service) Stop

func (service *Service) Stop(context moleculer.BrokerContext)

Stop called by the broker when the service is stopping.

func (*Service) Summary

func (service *Service) Summary() map[string]string

func (*Service) UpdateFromMap

func (service *Service) UpdateFromMap(serviceInfo map[string]interface{})

UpdateFromMap update the service metadata and settings from a serviceInfo map

func (*Service) Version

func (service *Service) Version() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL