Documentation
¶
Index ¶
- Variables
- type Context
- type EventGridTriggerFunc
- type FunctionApp
- type FunctionAppOption
- type FunctionOption
- func Binding(binding bindable) FunctionOption
- func EventGridTrigger(name string, fn EventGridTriggerFunc, options ...triggers.EventGridOption) FunctionOption
- func GenericTrigger(name string, fn GenericTriggerFunc, options ...triggers.GenericOption) FunctionOption
- func HTTPTrigger(fn HTTPTriggerFunc, options ...triggers.HTTPOption) FunctionOption
- func QueueTrigger(name string, fn QueueTriggerFunc, options ...triggers.QueueOption) FunctionOption
- func ServiceBusTrigger(name string, fn ServiceBusTriggerFunc, options ...triggers.ServiceBusOption) FunctionOption
- func TimerTrigger(fn TimerTriggerFunc, options ...triggers.TimerOption) FunctionOption
- type GenericTriggerFunc
- type HTTPTriggerFunc
- type Logger
- type Output
- type OutputOption
- type OutputOptions
- type QueueTriggerFunc
- type ServiceBusTriggerFunc
- type TimerTriggerFunc
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoFunction is returned when no function has been set to the // FunctionApp. ErrNoFunction = errors.New("at least one function must be set") )
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { // Output contains bindings. Output Output // contains filtered or unexported fields }
Context represents the function context and contains output, bindings, services and clients.
func (*Context) Clients ¶
func (c *Context) Clients() clients
Clients returns the clients set in the Context.
func (Context) Log ¶ added in v0.2.0
func (c Context) Log() logger
Log returns the logger of the Context.
type EventGridTriggerFunc ¶ added in v0.14.0
EventGridTriggerFunc represents an Event Grid trigger function to be executed by the function app.
type FunctionApp ¶
type FunctionApp struct {
// contains filtered or unexported fields
}
FunctionApp represents a Function App with its configuration and functions.
func NewFunctionApp ¶
func NewFunctionApp(options ...FunctionAppOption) *FunctionApp
NewFunction app creates and configures a FunctionApp.
func (*FunctionApp) AddFunction ¶
func (a *FunctionApp) AddFunction(name string, options ...FunctionOption)
AddFunction adds a function to the FunctionApp.
type FunctionAppOption ¶
type FunctionAppOption func(*FunctionApp)
FunctionAppOption is a function that sets options to a FunctionApp.
func WithClient ¶
func WithClient(name string, client any) FunctionAppOption
WithClient sets the provided client to the FunctionApp. Can be called multiple times. If a client with the same name has been set it will be overwritten.
func WithLogger ¶
func WithLogger(log logger) FunctionAppOption
WithLogger sets the provided logger to the FunctionApp. The logger must satisfy the logger interface.
func WithService ¶
func WithService(name string, service any) FunctionAppOption
WithService sets the provided service to the FunctionApp. Can be called multiple times. If a service with the same name has been set it will be overwritten.
type FunctionOption ¶
type FunctionOption func(f *function)
FunctionOption sets options to the function.
func Binding ¶
func Binding(binding bindable) FunctionOption
Binding sets the provided binding to the function.
func EventGridTrigger ¶ added in v0.14.0
func EventGridTrigger(name string, fn EventGridTriggerFunc, options ...triggers.EventGridOption) FunctionOption
EventGridTrigger takes the provided name and function and sets it as the function to be run by the trigger.
func GenericTrigger ¶ added in v0.15.0
func GenericTrigger(name string, fn GenericTriggerFunc, options ...triggers.GenericOption) FunctionOption
GenericTrigger takes the provided name and function and sets it as the function to be run by the trigger.
func HTTPTrigger ¶
func HTTPTrigger(fn HTTPTriggerFunc, options ...triggers.HTTPOption) FunctionOption
HTTPTrigger takes the provided function and sets it as the function to be run by the trigger.
func QueueTrigger ¶
func QueueTrigger(name string, fn QueueTriggerFunc, options ...triggers.QueueOption) FunctionOption
QueueTrigger takes the provided name and function and sets it as the function to be run by the trigger.
func ServiceBusTrigger ¶ added in v0.7.0
func ServiceBusTrigger(name string, fn ServiceBusTriggerFunc, options ...triggers.ServiceBusOption) FunctionOption
ServiceBusTrigger takes the provided name and function and sets it as the function to be run by the trigger.
func TimerTrigger ¶
func TimerTrigger(fn TimerTriggerFunc, options ...triggers.TimerOption) FunctionOption
TimerTrigger takes the provided function and sets it as the function to be run by the trigger.
type GenericTriggerFunc ¶ added in v0.15.0
GenericTriggerFunc represents a generic function to be executed by the function app.
type HTTPTriggerFunc ¶
HTTPTriggerFunc represents an HTTP trigger function to be executed by the function app.
type Logger ¶ added in v0.16.0
type Logger struct {
// contains filtered or unexported fields
}
Logger wraps around the log/slog package and satisfies the logger.
func NewLogger ¶ added in v0.16.0
func NewLogger() Logger
NewLogger creates and returns a new Logger. Errors and warnings are written to stderr, while debug and info messages are written to stdout.
type Output ¶ added in v0.11.0
type Output struct { Outputs map[string]bindable ReturnValue any Logs []string // contains filtered or unexported fields }
Output represents an outgoing response to the Functuon Host.
func NewOutput ¶ added in v0.11.0
func NewOutput(options ...OutputOption) Output
NewOutput creates a new Output containing binding to be used for creating the response back to the Function host.
func (*Output) AddBindings ¶ added in v0.11.0
func (o *Output) AddBindings(bindables ...bindable)
AddBindings one or more bindings to Output.
func (Output) Binding ¶ added in v0.11.0
Binding returns the binding with the provided name, if no binding with that name exists, return a new generic binding with the provided name.
func (*Output) HTTP ¶ added in v0.11.0
HTTP returns the HTTP binding of output if any is set. If not set it will create, set and return it.
func (Output) MarshalJSON ¶ added in v0.11.0
MarshalJSON implements custom marshaling to produce the required JSON structure as expected by the function host.
func (*Output) SetReturnValue ¶ added in v0.11.0
SetReturnValue sets ReturnValue of Output.
type OutputOption ¶ added in v0.11.0
type OutputOption func(o *OutputOptions)
Output option is a function that sets OutputOptions.
func WithBindings ¶ added in v0.11.0
func WithBindings(bindables ...bindable) OutputOption
WithBindings add one or more bindings to OutputOptions
type OutputOptions ¶ added in v0.11.0
type OutputOptions struct { ReturnValue any Bindings []bindable Logs []string // contains filtered or unexported fields }
OutputOptions contains options for creating a new Output.
type QueueTriggerFunc ¶ added in v0.7.0
QueueTriggerFunc represents a Queue Storage trigger function to be exexuted by the function app.
type ServiceBusTriggerFunc ¶ added in v0.7.0
type ServiceBusTriggerFunc func(ctx *Context, trigger *triggers.ServiceBus) error
ServiceBusTriggerFunc represents a Service Bus trigger function to be exexuted by the function app.