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

Function validateSubject

jetstream/jetstream.go:1015–1023  ·  view source on GitHub ↗
(subject string)

Source from the content-addressed store, hash-verified

1013}
1014
1015func validateSubject(subject string) error {
1016 if subject == "" {
1017 return fmt.Errorf("%w: %s", ErrInvalidSubject, "subject cannot be empty")
1018 }
1019 if subject[0] == '.' || subject[len(subject)-1] == '.' || !subjectRegexp.MatchString(subject) {
1020 return fmt.Errorf("%w: %s", ErrInvalidSubject, subject)
1021 }
1022 return nil
1023}
1024
1025// AccountInfo fetches account information from the server, containing details
1026// about the account associated with this JetStream connection. If account is

Callers 3

upsertConsumerFunction · 0.70
StreamNameBySubjectMethod · 0.70
TestValidateSubjectFunction · 0.70

Calls 1

ErrorfMethod · 0.80

Tested by 1

TestValidateSubjectFunction · 0.56