MCPcopy
hub / github.com/nats-io/nats.go / valid

Method valid

micro/service.go:524–536  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

522}
523
524func (c *Config) valid() error {
525 if !nameRegexp.MatchString(c.Name) {
526 return fmt.Errorf("%w: service name: name should not be empty and should consist of alphanumerical characters, dashes and underscores", ErrConfigValidation)
527 }
528 if !semVerRegexp.MatchString(c.Version) {
529 return fmt.Errorf("%w: version: version should not be empty should match the SemVer format", ErrConfigValidation)
530 }
531 if c.QueueGroup != "" && !subjectRegexp.MatchString(c.QueueGroup) {
532 return fmt.Errorf("%w: queue group: invalid queue group name", ErrConfigValidation)
533 }
534
535 return nil
536}
537
538func (s *service) wrapConnectionEventCallbacks() {
539 s.m.Lock()

Callers 1

AddServiceFunction · 0.80

Calls 1

ErrorfMethod · 0.80

Tested by

no test coverage detected