Documentation
¶
Overview ¶
Package service provides domain services that orchestrate transformer execution. Services coordinate between entities and ports without depending on adapters.
pkg/domain/service/enrichment_service.go
pkg/domain/service/transformation_service.go
pkg/domain/service/validation_service.go
Index ¶
- type EnrichmentService
- type ServiceConfig
- type TransformationService
- func (s *TransformationService) Execute(ctx context.Context, transformer entity.Transformer, input any) *entity.TransformResult
- func (s *TransformationService) ExecuteChain(ctx context.Context, transformers []entity.Transformer, input any) *entity.TransformResult
- func (s *TransformationService) SetCacheTTL(ttl time.Duration)
- type ValidationService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EnrichmentService ¶
type EnrichmentService struct {
// contains filtered or unexported fields
}
EnrichmentService manages data enrichment operations
func NewEnrichmentService ¶
func NewEnrichmentService(enrichmentPort port.EnrichmentPort, metricsPort port.MetricsPort) *EnrichmentService
NewEnrichmentService creates a new enrichment service
type ServiceConfig ¶
type ServiceConfig struct {
// CacheTTL is the default time-to-live for cached transformation results
CacheTTL time.Duration
// MetricsEnabled controls whether services emit metrics
MetricsEnabled bool
// RetryAttempts is the number of times to retry failed operations
RetryAttempts int
// CircuitBreakerThreshold is the failure threshold before opening circuit
CircuitBreakerThreshold float64
}
ServiceConfig holds common configuration for all domain services
func DefaultServiceConfig ¶
func DefaultServiceConfig() ServiceConfig
DefaultServiceConfig returns sensible defaults for service configuration
type TransformationService ¶
type TransformationService struct {
// contains filtered or unexported fields
}
TransformationService orchestrates transformations with caching and metrics
func NewTransformationService ¶
func NewTransformationService(cachePort port.CachePort, metricsPort port.MetricsPort) *TransformationService
NewTransformationService creates a new service
func (*TransformationService) Execute ¶
func (s *TransformationService) Execute(ctx context.Context, transformer entity.Transformer, input any) *entity.TransformResult
Execute performs a transformation with caching
func (*TransformationService) ExecuteChain ¶
func (s *TransformationService) ExecuteChain(ctx context.Context, transformers []entity.Transformer, input any) *entity.TransformResult
ExecuteChain applies multiple transformers in sequence
func (*TransformationService) SetCacheTTL ¶
func (s *TransformationService) SetCacheTTL(ttl time.Duration)
SetCacheTTL sets the cache TTL for transformation results.
type ValidationService ¶
type ValidationService struct {
// contains filtered or unexported fields
}
ValidationService validates inputs and rules
func NewValidationService ¶
func NewValidationService() *ValidationService
NewValidationService creates a new validation service
func NewValidationServiceWithMetrics ¶
func NewValidationServiceWithMetrics(metricsPort port.MetricsPort) *ValidationService
NewValidationServiceWithMetrics creates a new validation service with metrics
func (*ValidationService) Validate ¶
func (s *ValidationService) Validate(input any) error
Validate checks if input is valid
func (*ValidationService) ValidateChain ¶
func (s *ValidationService) ValidateChain(transformers []any) error
ValidateChain checks if transformer chain is valid
func (*ValidationService) ValidateTransformer ¶
func (s *ValidationService) ValidateTransformer(transformer any) error
ValidateTransformer checks if transformer is valid