Documentation
¶
Index ¶
- type Option
- type RegisteredFunction
- type Registry
- func (r *Registry) GetAllFunctions() []*RegisteredFunction
- func (r *Registry) GetLastFunctionWithoutName() *RegisteredFunction
- func (r *Registry) GetRegisteredFunction(name string) (*RegisteredFunction, bool)
- func (r *Registry) RegisterCloudEvent(fn func(context.Context, cloudevents.Event) error, options ...Option) error
- func (r *Registry) RegisterEvent(fn interface{}, options ...Option) error
- func (r *Registry) RegisterHTTP(fn func(http.ResponseWriter, *http.Request), options ...Option) error
- func (r *Registry) RegisterTyped(fn interface{}, options ...Option) error
- func (r *Registry) Reset()
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.
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 TypedFn interface{} // Optional: The user's typed 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 (*Registry) GetAllFunctions ¶ added in v1.6.0
func (r *Registry) GetAllFunctions() []*RegisteredFunction
GetAllFunctions returns all the registered functions.
func (*Registry) GetLastFunctionWithoutName ¶ added in v1.7.0
func (r *Registry) GetLastFunctionWithoutName() *RegisteredFunction
GetLastFunctionWithoutName returns the last function that's not registered declaratively. As the function is registered without a name, it can not be found by setting FUNCTION_TARGET when deploying. In this case, the last function that's not registered declaratively will be served.
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(fn func(context.Context, cloudevents.Event) error, options ...Option) error
RegisterCloudEvent registers a CloudEvent function.
func (*Registry) RegisterEvent ¶ added in v1.6.0
RegisterEvent registers an Event function.
func (*Registry) RegisterHTTP ¶ added in v1.5.0
func (r *Registry) RegisterHTTP(fn func(http.ResponseWriter, *http.Request), options ...Option) error
RegisterHTTP registes a HTTP function.
func (*Registry) RegisterTyped ¶ added in v1.7.0
RegisterTyped registers a strongly typed function.