(serviceName string, svcObj any)
| 425 | } |
| 426 | |
| 427 | func ValidateService(serviceName string, svcObj any) error { |
| 428 | svcType := reflect.TypeOf(svcObj) |
| 429 | if svcType.Kind() != reflect.Ptr { |
| 430 | return fmt.Errorf("service object %q must be a pointer", serviceName) |
| 431 | } |
| 432 | svcType = svcType.Elem() |
| 433 | if svcType.Kind() != reflect.Struct { |
| 434 | return fmt.Errorf("service object %q must be a ptr to struct", serviceName) |
| 435 | } |
| 436 | for idx := 0; idx < svcType.NumMethod(); idx++ { |
| 437 | method := svcType.Method(idx) |
| 438 | if strings.HasSuffix(method.Name, "_Meta") { |
| 439 | err := validateServiceMetaMethod(serviceName, method) |
| 440 | if err != nil { |
| 441 | return err |
| 442 | } |
| 443 | } |
| 444 | if err := validateServiceMethod(serviceName, method); err != nil { |
| 445 | return err |
| 446 | } |
| 447 | } |
| 448 | return nil |
| 449 | } |
| 450 | |
| 451 | func ValidateServiceMap() error { |
| 452 | for svcName, svcObj := range ServiceMap { |
no test coverage detected