Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrPageTypeNameInvalid = errors.New("invalid page type name") ErrActionMethodNameInvalid = errors.New("invalid action method name") ErrEventTypeNameInvalid = errors.New("invalid event type name") ErrEventCommMissing = errors.New("missing event subject comment") ErrEventCommInvalid = errors.New("invalid event subject comment syntax") ErrEventSubjectInvalid = errors.New("invalid event subject") ErrEventHandlerNameInvalid = errors.New("invalid event handler method name") )
Functions ¶
func ActionMethodName ¶
ActionMethodName validates action handler method names:
POSTX... PUTX... DELETEX...
where X is [A-Z], followed by [A-Za-z0-9]*.
func EventHandlerMethodName ¶
EventHandlerMethodName validates event handler method names: "On" + Uppercase letter + [A-Za-z0-9]*.
func EventSubjectComment ¶
func EventSubjectComment(typeName string, doc *ast.CommentGroup) error
EventSubjectComment validates an event subject comment.
Expected header (must be the first doc line):
// EventFoo is "foo.bar"
If there are more doc lines, an empty comment line is mandatory:
// EventFoo is "foo.bar" // // description...
Errors:
- ErrEventCommMissing: no doc comment.
- ErrEventCommInvalid: doc exists, but header/spacing is wrong.
- ErrEventSubjectInvalid: header ok, but quoted subject invalid.
func EventSubjectCommentSubject ¶
EventSubjectCommentSubject validates the raw subject comment payload for an event. Accepts: `"foo.bar"`. Rejects: missing quotes, empty, or unterminated.
func EventTypeName ¶
EventTypeName validates event type names: "Event" + Uppercase letter + [A-Za-z0-9]*.
func PageTypeName ¶
PageTypeName validates page type names: "Page" + Uppercase letter + [A-Za-z0-9]*.
Types ¶
This section is empty.