mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-11-15 00:15:13 +00:00
refactor: Replace interface{} with any and optimize slice operations
- Replace map[string]interface{} with map[string]any in UpdateCarrierMetrics
- Replace interface{} with any for GeneratedAt field in PricingEffectiveness struct
- Replace loop-based empty string checks with slices.Contains in ValidateConditions
- Replace range loop index initialization with range-only syntax in calculateAPIPerformance
- Add slices import for standard library slice utilities
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"slices"
|
||||
|
||||
"github.com/nutcas3/telecom-platform/apps/carrier-connector/internal/pricing"
|
||||
)
|
||||
@@ -121,17 +122,13 @@ func (v *PricingValidator) ValidateConditions(ctx context.Context, conditions pr
|
||||
}
|
||||
|
||||
// Validate geography
|
||||
for _, geo := range conditions.Geography {
|
||||
if geo == "" {
|
||||
return errors.New("geography cannot be empty")
|
||||
}
|
||||
if slices.Contains(conditions.Geography, "") {
|
||||
return errors.New("geography cannot be empty")
|
||||
}
|
||||
|
||||
// Validate customer type
|
||||
for _, ct := range conditions.CustomerType {
|
||||
if ct == "" {
|
||||
return errors.New("customer type cannot be empty")
|
||||
}
|
||||
if slices.Contains(conditions.CustomerType, "") {
|
||||
return errors.New("customer type cannot be empty")
|
||||
}
|
||||
|
||||
// Validate volume range
|
||||
|
||||
Reference in New Issue
Block a user