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 ¶
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 ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is a registry of functions.
func (*Registry) GetAllFunctions ¶
func (r *Registry) GetAllFunctions() []*RegisteredFunction
GetAllFunctions returns all the registered functions.
func (*Registry) GetLastFunctionWithoutName ¶
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 ¶
func (r *Registry) GetRegisteredFunction(name string) (*RegisteredFunction, bool)
GetRegisteredFunction a registered function by name
func (*Registry) RegisterCloudEvent ¶
func (r *Registry) RegisterCloudEvent(fn func(context.Context, cloudevents.Event) error, options ...Option) error
RegisterCloudEvent registers a CloudEvent function.
func (*Registry) RegisterEvent ¶
RegisterEvent registers an Event function.
func (*Registry) RegisterHTTP ¶
func (r *Registry) RegisterHTTP(fn func(http.ResponseWriter, *http.Request), options ...Option) error
RegisterHTTP registes a HTTP function.
func (*Registry) RegisterTyped ¶
RegisterTyped registers a strongly typed function.