Documentation
¶
Overview ¶
Package service provides a wrapper around NATS for microservices.
Index ¶
- type TinyService
- func (nm *TinyService) AddEndpoint(name string, handler micro.Handler, opts ...micro.EndpointOpt) error
- func (nm *TinyService) ConfigStore() (jetstream.KeyValue, error)
- func (nm *TinyService) CreateConfig() error
- func (nm *TinyService) Init() error
- func (nm *TinyService) RunBlocking() error
- func (nm *TinyService) Stop()
- type TinyServiceOption
- func WithDescription(description string) TinyServiceOption
- func WithDoneHandler(handler micro.DoneHandler) TinyServiceOption
- func WithEndpoint(endpoint *micro.EndpointConfig) TinyServiceOption
- func WithErrorHandler(handler micro.ErrHandler) TinyServiceOption
- func WithGroup(groupName string) TinyServiceOption
- func WithName(name string) TinyServiceOption
- func WithNatsConn(nc *nats.Conn) TinyServiceOption
- func WithNatsOptions(opts ...nats.Option) TinyServiceOption
- func WithNatsURL(url string) TinyServiceOption
- func WithStatsHandler(handler micro.StatsHandler) TinyServiceOption
- func WithVersion(version string) TinyServiceOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TinyService ¶
type TinyService struct {
// Config is the configuration for the NatsMicro instance.
micro.Config
// contains filtered or unexported fields
}
func NewTinyService ¶
func NewTinyService(opts ...TinyServiceOption) (*TinyService, error)
NewTinyService creates a new NatsMicro instance with the given NATS connection and configuration.
func (*TinyService) AddEndpoint ¶
func (nm *TinyService) AddEndpoint(name string, handler micro.Handler, opts ...micro.EndpointOpt) error
func (*TinyService) ConfigStore ¶ added in v0.2.0
func (nm *TinyService) ConfigStore() (jetstream.KeyValue, error)
func (*TinyService) CreateConfig ¶ added in v0.2.0
func (nm *TinyService) CreateConfig() error
func (*TinyService) Init ¶
func (nm *TinyService) Init() error
func (*TinyService) RunBlocking ¶
func (nm *TinyService) RunBlocking() error
func (*TinyService) Stop ¶
func (nm *TinyService) Stop()
type TinyServiceOption ¶
type TinyServiceOption func(*TinyService)
TinyServiceOption is a function that configures the NatsMicro instance.
func WithDescription ¶
func WithDescription(description string) TinyServiceOption
WithDescription sets the description for the NatsMicro instance.
func WithDoneHandler ¶
func WithDoneHandler(handler micro.DoneHandler) TinyServiceOption
WithDoneHandler sets the done handler for the NatsMicro instance.
func WithEndpoint ¶
func WithEndpoint(endpoint *micro.EndpointConfig) TinyServiceOption
WithEndpoint sets the endpoint for the NatsMicro instance.
func WithErrorHandler ¶
func WithErrorHandler(handler micro.ErrHandler) TinyServiceOption
WithErrorHandler sets the error handler for the NatsMicro instance.
func WithGroup ¶
func WithGroup(groupName string) TinyServiceOption
WithGroup sets the group name for the NatsMicro instance.
func WithName ¶
func WithName(name string) TinyServiceOption
WithName sets the name for the NatsMicro instance.
func WithNatsConn ¶
func WithNatsConn(nc *nats.Conn) TinyServiceOption
WithNatsConn sets the NATS connection for the NatsMicro instance.
func WithNatsOptions ¶
func WithNatsOptions(opts ...nats.Option) TinyServiceOption
WithNatsOptions sets the NATS options for the NatsMicro instance.
func WithNatsURL ¶
func WithNatsURL(url string) TinyServiceOption
WithNatsURL sets the NATS URL for the NatsMicro instance.
func WithStatsHandler ¶
func WithStatsHandler(handler micro.StatsHandler) TinyServiceOption
WithStatsHandler sets the stats handler for the NatsMicro instance.
func WithVersion ¶
func WithVersion(version string) TinyServiceOption
WithVersion sets the version for the NatsMicro instance.