Documentation ¶
Index ¶
- func IsEventTypeOneof(field *types.Field) bool
- func IsoriginRequest(field *types.Field) bool
- func IsoriginResponse(field *types.Field) bool
- func OmitInEventConstructor(field *types.Field) bool
- func OutputDir(sourceDir string) string
- func PackageName(sourcePackagePath string) string
- func PackagePath(sourcePackagePath string) string
- type EventNode
- func (node *EventNode) AllConstructorParameters() params.FunctionParamList
- func (node *EventNode) Children() []*EventNode
- func (node *EventNode) Constructor() *jen.Statement
- func (node *EventNode) IsEvent() bool
- func (node *EventNode) IsEventClass() bool
- func (node *EventNode) IsRoot() bool
- func (node *EventNode) Message() *types.Message
- func (node *EventNode) Name() string
- func (node *EventNode) OneofOption() *types.OneofOption
- func (node *EventNode) OriginRequest() *Origin
- func (node *EventNode) OriginResponse() *Origin
- func (node *EventNode) Parent() *EventNode
- func (node *EventNode) ThisNodeConstructorParameters() params.ConstructorParamList
- func (node *EventNode) TypeOneof() *types.Oneof
- type Origin
- type Parser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsEventTypeOneof ¶
IsEventTypeOneof returns true iff the field is a oneof and is marked with option (mir.event_type) = true.
func IsoriginRequest ¶
IsoriginRequest returns true iff the field is marked with [(mir.origin_request) = true].
func IsoriginResponse ¶
IsoriginResponse returns true iff the field is marked with [(mir.origin_response) = true].
func OmitInEventConstructor ¶
OmitInEventConstructor returns true iff the field is marked with [(mir.omit_in_event_constructor) = true].
func PackageName ¶
func PackagePath ¶
Types ¶
type EventNode ¶
type EventNode struct {
// contains filtered or unexported fields
}
EventNode represents a node in the tree corresponding to the hierarchy of events.
func (*EventNode) AllConstructorParameters ¶
func (node *EventNode) AllConstructorParameters() params.FunctionParamList
AllConstructorParameters returns the accumulated parameters for the constructor function. The parameters include all the fields of all the ancestors in the hierarchy except those marked with [(mir.omit_in_event_constructors) = true] and the Type oneofs.
func (*EventNode) Children ¶
Children returns the children events in the hierarchy. NB: It may happen that an event class has no children.
func (*EventNode) Constructor ¶
Constructor returns the code corresponding to the constructor function for this event.
func (*EventNode) IsEventClass ¶
IsEventClass returns true iff the message has a oneof field marked with [(mir.event_type) = true].
func (*EventNode) OneofOption ¶
func (node *EventNode) OneofOption() *types.OneofOption
OneofOption returns the option in the parent's Type oneof. If nil, IsRoot() must be true.
func (*EventNode) OriginRequest ¶
OriginRequest returns a field marked with [(mir.origin_request) = true] (if any).
func (*EventNode) OriginResponse ¶
OriginResponse returns a field marked with [(mir.origin_response) = true] (if any).
func (*EventNode) ThisNodeConstructorParameters ¶
func (node *EventNode) ThisNodeConstructorParameters() params.ConstructorParamList
ThisNodeConstructorParameters returns a suffix of AllConstructorParameters() that corresponds to the fields only of this in the hierarchy, without the parameters accumulated from the ancestors.
type Origin ¶
type Origin struct { // The field marked with [(mir.origin_request) = true] or [(mir.origin_response) = true]. Field *types.Field // Same as Field.Type.(*types.Message). Message *types.Message // The field "Module" of the origin type. ModuleField *types.Field // The oneof "Type" of the origin type. TypeOneof *types.Oneof }
Origin represents a field marked with [(mir.origin_request) = true] or [(mir.origin_response) = true]. The field must be of a message type with a field "Module" and a oneof "Type".
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func DefaultParser ¶
func DefaultParser() *Parser
DefaultParser returns a singleton Parser. It must not be accessed concurrently.
func (*Parser) ParseEventHierarchy ¶
ParseEventHierarchy extracts the information about the whole event hierarchy by its root.
func (*Parser) TypesParser ¶
TypesParser returns the types.Parser used to parse the types in the event hierarchy.