Documentation
¶
Index ¶
- func ServiceName(name string) service.Name
- type Service
- func (s *Service) Abort(message string, err error)
- func (s *Service) CustomDefinitions() map[string]interface{}deprecated
- func (s *Service) DeployEnvironment() definition.ServiceDeploydeprecated
- func (s *Service) Env(name string) stringdeprecated
- func (s *Service) Errors() errors_api.ErrorAPIdeprecated
- func (s *Service) Feature(ctx context.Context, target interface{}) error
- func (s *Service) Logger() logger_api.LoggerAPIdeprecated
- func (s *Service) ServiceName() stringdeprecated
- func (s *Service) SetupTest(ctx context.Context, t *testing.Testing) *ServiceTesting
- func (s *Service) Start(srv interface{})
- func (s *Service) WithExternalFeatures(features *plugin.FeatureSet) *Service
- func (s *Service) WithExternalServices(services *plugin.ServiceSet) *Service
- type ServiceTesting
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ServiceName ¶
ServiceName is the way to retrieve a service name from a string.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the object that represents a service application.
func NewService ¶
func NewService(opt *options.NewServiceOptions) *Service
NewService creates a new Service object for building and putting to run a new application.
We don't return an error here to force the application to end in case something wrong happens.
func (*Service) Abort ¶
Abort is a helper method to abort services in the right way, when external initialization is needed.
func (*Service) CustomDefinitions
deprecated
CustomDefinitions gives the service access to the service custom settings that it may have put inside the 'service.toml' file.
Note that these settings correspond to everything under the service object inside the TOML file.
Deprecated: This method is deprecated and should not be used anymore. To load custom service definitions, use the tag `mikros:"definitions"` with a structure member inside the service.
func (*Service) DeployEnvironment
deprecated
func (s *Service) DeployEnvironment() definition.ServiceDeploy
DeployEnvironment exposes the current service deploymentEnv environment.
Deprecated: This method is deprecated and should not be used anymore. To know this information, one must declare an internal service feature for the environment variables and initialize it using struct tags.
func (*Service) Env
deprecated
func (*Service) Errors
deprecated
func (s *Service) Errors() errors_api.ErrorAPI
Errors gives access to the errors API from inside a service context.
Deprecated: This method is deprecated and should not be used anymore. To access the error API, one must declare an internal service feature and initialize it using struct tags.
func (*Service) Feature ¶
Feature is the service mechanism to have access to an external feature public API.
func (*Service) Logger
deprecated
func (s *Service) Logger() logger_api.LoggerAPI
Logger gives access to the logger API from inside a service context.
Deprecated: This method is deprecated and should not be used anymore. To access the log API, one must declare an internal service feature and initialize it using struct tags.
func (*Service) ServiceName
deprecated
func (*Service) SetupTest ¶
SetupTest is an api that should start the testing environment for a unit test.
func (*Service) Start ¶
func (s *Service) Start(srv interface{})
Start puts the service in execution mode and blocks execution. This function should be the last one called by the service.
We don't return an error here so that the service does not need to handle it inside its code. We abort in case of an error.
func (*Service) WithExternalFeatures ¶
func (s *Service) WithExternalFeatures(features *plugin.FeatureSet) *Service
WithExternalFeatures allows a service to add external features into it, so they can be used from it.
func (*Service) WithExternalServices ¶
func (s *Service) WithExternalServices(services *plugin.ServiceSet) *Service
WithExternalServices allows a service to add external service implementations into it.
type ServiceTesting ¶
type ServiceTesting struct {
// contains filtered or unexported fields
}
ServiceTesting is an object created by a Service.SetupTest call.
It should be used when creating unit tests that need to use features, internal or external, and require some kind of setup/teardown mechanism.
func (*ServiceTesting) Do ¶
func (s *ServiceTesting) Do(ctx context.Context) error
Do is a function that executes tests from inside all registered features.
func (*ServiceTesting) Teardown ¶
func (s *ServiceTesting) Teardown(ctx context.Context)
Teardown releases every resource allocated by the SetupTest call.
Directories
¶
| Path | Synopsis |
|---|---|
|
apis
|
|
|
components
|
|
|
env
Package env loads environment variables into a struct using field tags.
|
Package env loads environment variables into a struct using field tags. |
|
http
Package http provides a comprehensive set of HTTP request parameter binding utilities for Go applications.
|
Package http provides a comprehensive set of HTTP request parameter binding utilities for Go applications. |
|
testing
Package testing is a framework package to be used inside services unit tests providing an API to build specific services unit tests.
|
Package testing is a framework package to be used inside services unit tests providing an API to build specific services unit tests. |
|
examples
|
|
|
protobuf-workspace
module
|
|
|
internal
|
|
|
components/validations
Package validations adds an internal framework API to validate structures without tag annotations.
|
Package validations adds an internal framework API to validate structures without tag annotations. |