registry

package
Version: v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option added in v1.6.0

type Option func(*RegisteredFunction)

Option is an option used when registering a function.

func WithPath added in v1.6.0

func WithPath(path string) Option

type RegisteredFunction

type RegisteredFunction struct {
	Name         string                                         // The name of the function
	Path         string                                         // The serving path of the function
	CloudEventFn func(context.Context, cloudevents.Event) error // Optional: The user's CloudEvent function
	HTTPFn       func(http.ResponseWriter, *http.Request)       // Optional: The user's HTTP function
	EventFn      interface{}                                    // Optional: The user's Event function
}

RegisteredFunction represents a function that has been registered with the registry.

type Registry added in v1.5.0

type Registry struct {
	// contains filtered or unexported fields
}

Registry is a registry of functions.

func Default added in v1.5.0

func Default() *Registry

Default returns the default, singleton registry instance.

func New added in v1.5.0

func New() *Registry

func (*Registry) DeleteRegisteredFunction added in v1.6.0

func (r *Registry) DeleteRegisteredFunction(name string)

DeleteRegisteredFunction deletes a registered function.

func (*Registry) GetAllFunctions added in v1.6.0

func (r *Registry) GetAllFunctions() map[string]RegisteredFunction

GetAllFunctions returns all the registered functions.

func (*Registry) GetRegisteredFunction added in v1.5.0

func (r *Registry) GetRegisteredFunction(name string) (RegisteredFunction, bool)

GetRegisteredFunction a registered function by name

func (*Registry) RegisterCloudEvent added in v1.5.0

func (r *Registry) RegisterCloudEvent(name string, fn func(context.Context, cloudevents.Event) error, options ...Option) error

RegistryCloudEvent a CloudEvent function with a given name

func (*Registry) RegisterEvent added in v1.6.0

func (r *Registry) RegisterEvent(name string, fn interface{}, options ...Option) error

RegistryCloudEvent a Event function with a given name

func (*Registry) RegisterHTTP added in v1.5.0

func (r *Registry) RegisterHTTP(name string, fn func(http.ResponseWriter, *http.Request), options ...Option) error

RegisterHTTP a HTTP function with a given name

Source Files

Jump to

Keyboard shortcuts

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