dispatcher

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(file File) ([]byte, error)

Generate generates an event dispatcher.

Types

type EventDispatcher added in v0.1.0

type EventDispatcher struct {
	Name              string
	DispatcherMethods []EventMethod
}

EventDispatcher describes the event dispatcher interface.

func EventDispatcherFromEvents added in v0.1.0

func EventDispatcherFromEvents(events Events) EventDispatcher

EventDispatcherFromEvents creates an EventDispatcher from Events. nolint: golint

type EventMethod added in v0.1.0

type EventMethod struct {
	Name            string
	Event           gentypes.TypeRef
	ReceivesContext bool
	ReturnsError    bool
}

EventMethod describes a dispatcher method in an event dispatcher.

type Events added in v0.1.0

type Events struct {
	gentypes.TypeRef

	Methods []EventMethod
}

Events describes the event dispatcher interface.

func Parse

func Parse(dir string, interfaceName string) (Events, error)

Parse parses a given package, looks for an interface and returns it as a normalized structure.

func ParseEvents added in v0.1.0

func ParseEvents(obj types.Object) (Events, error)

ParseEvents parses an object as an event dispatcher.

type File added in v0.1.0

type File struct {
	gentypes.File

	// EventDispatchers represents event dispatchers to be generated for matching interfaces.
	EventDispatchers []EventDispatcher
}

File provides information for generating event dispatchers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL