Documentation
¶
Overview ¶
Package function provides primivites for handler functions.
Index ¶
- Variables
- type Allocatable
- type Argument
- type Binary
- type Binding
- type BindingType
- type Config
- type Context
- type DataType
- type Direction
- type Function
- type H
- type HttpRequest
- type HttpRequestHeaders
- type HttpResponse
- type HttpResponseHeaders
- type Log
- type RawData
- func (r RawData) Bool(path string) (bool, error)
- func (r RawData) Float(path string) (float32, error)
- func (r RawData) Float32(path string) (float32, error)
- func (r RawData) Float64(path string) (float64, error)
- func (r RawData) Int(path string) (int, error)
- func (r RawData) Int16(path string) (int16, error)
- func (r RawData) Int32(path string) (int32, error)
- func (r RawData) Int64(path string) (int64, error)
- func (r RawData) Int8(path string) (int8, error)
- func (r RawData) Map(path string) (map[string]interface{}, error)
- func (r RawData) Slice(path string) ([]interface{}, error)
- func (r RawData) String(path string) (string, error)
- func (r RawData) Uint(path string) (uint, error)
- func (r RawData) Uint16(path string) (uint16, error)
- func (r RawData) Uint32(path string) (uint32, error)
- func (r RawData) Uint64(path string) (uint64, error)
- func (r RawData) Uint8(path string) (uint8, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrBadReference = errors.New("bad reference") ErrBindingNotFound = errors.New("binding not found") )
var (
ErrUnknownProperty = errors.New("unknown property")
)
Functions ¶
This section is empty.
Types ¶
type Allocatable ¶
type Allocatable interface {
Allocate() error
}
type Argument ¶
type Argument struct {
Name string
Type reflect.Type
Value reflect.Value
Direction Direction
// contains filtered or unexported fields
}
func NewArgument ¶
type Binary ¶
Convenience type for binary input and outpu bindings. Handles "null" values correctly.
func (Binary) MarshalJSON ¶
func (Binary) UnmarshalJSON ¶
type Binding ¶
type Binding struct {
Name string `json:"name"`
Type BindingType `json:"type"`
Direction Direction `json:"direction"`
DataType DataType `json:"dataType"`
}
type BindingType ¶
type BindingType string
const ( TypeServiceBusTrigger BindingType = "serviceBusTrigger" TypeServiceBus BindingType = "serviceBus" TypeBlobTrigger BindingType = "blobTrigger" TypeBlob BindingType = "blob" TypeManualTrigger BindingType = "manualTrigger" TypeEventHubTrigger BindingType = "eventHubTrigger" TypeEventHub BindingType = "eventHub" TypeTimerTrigger BindingType = "timerTrigger" TypeQueueTrigger BindingType = "queueTrigger" TypeQueue BindingType = "queue" TypeHttpTrigger BindingType = "httpTrigger" TypeHttp BindingType = "http" TypeMobileTable BindingType = "mobileTable" TypeDocumentDB BindingType = "documentDB" TypeTable BindingType = "table" TypeNotificationHub BindingType = "notificationHub" TypeTwilioSms BindingType = "twilioSms" TypeSendGrid BindingType = "sendGrid" )
type Config ¶
type Config struct {
Bindings []Binding `json:"bindings"`
Excluded bool `json:"excluded,omitempty"`
EntryPoint string `json:"entryPoint,omitempty"`
ScriptFile string `json:"scriptFile,omitempty"`
}
func NewConfigFromFile ¶
type Context ¶
type Context struct {
Data RawData
Metadata RawData
Outputs map[string]interface{}
Logs []string
Log Log
}
Context for handler functions provides access to invocation data, output bindings and function logging.
func NewContext ¶
NewContext creates a new context struct from provided invocation data.
type H ¶
type H map[string]interface{}
Shortcut for map[string]interface{}, usefull for defining arbitrary JSON structures etc. Shamelessly copied from gin.
type HttpRequest ¶
type HttpRequest struct {
Url string
Method string
Body string
Query map[string]string
Headers HttpRequestHeaders
Params map[string]string
Identities []struct {
AuthenticationType string
IsAuthenticated bool
Actor string
BootstrapContext string
Claims []string
Label string
Name string
NameClaimType string
RoleClaimType string
}
}
HttpRequest models the HttpTrigger request object.
func (*HttpRequest) BodyJSON ¶
func (h *HttpRequest) BodyJSON(v any) error
Parse JSON encoded request body data. Argument handled in the manner of json.Unmarshal.
func (*HttpRequest) IsJSON ¶
func (h *HttpRequest) IsJSON() bool
IsJson checks if the request body is JSON encoded.
type HttpRequestHeaders ¶
Shotcut for map[string][]string
type HttpResponse ¶
type HttpResponse struct {
Status uint32
Body interface{}
Headers HttpResponseHeaders
}
HttpResponse models the HttpTrigger out binding data. All fields are optional. The default value for Status is 200.
func (HttpResponse) MarshalJSON ¶
func (h HttpResponse) MarshalJSON() ([]byte, error)
type HttpResponseHeaders ¶
Shotcut for map[string][]string
func ContentTypeJson ¶
func ContentTypeJson() HttpResponseHeaders
func ContentTypeText ¶
func ContentTypeText() HttpResponseHeaders
func (*HttpResponseHeaders) ContentType ¶
func (h *HttpResponseHeaders) ContentType(val string) *HttpResponseHeaders
ContentType sets the HttpResponseHeaders content type.
func (*HttpResponseHeaders) ContentTypeJson ¶
func (h *HttpResponseHeaders) ContentTypeJson() *HttpResponseHeaders
Shortcut for ContentType("application/json")
func (*HttpResponseHeaders) ContentTypeText ¶
func (h *HttpResponseHeaders) ContentTypeText() *HttpResponseHeaders
Shortcut for ContentType("text/plain")
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
Log provides a scoped access for context logging functions.
func (*Log) Print ¶
Print appends to function execution context log. Arguments are handled in the manner of fmt.Sprint.
type RawData ¶
type RawData map[string]json.RawMessage
RawData type to access data provided in invocation requests.
func (RawData) Bool ¶
Bool unmarshals a bool value from the given path. The path is a property path with support for dot notation.
func (RawData) Float ¶
Float unmarshals a float32 value from the given path. The path is a property path with support for dot notation.
func (RawData) Float32 ¶
Float32 unmarshals a float32 value from the given path. The path is a property path with support for dot notation.
func (RawData) Float64 ¶
Float64 unmarshals a float64 value from the given path. The path is a property path with support for dot notation.
func (RawData) Int ¶
Int unmarshals an int value from the given path. The path is a property path with support for dot notation.
func (RawData) Int16 ¶
Int16 unmarshals an int16 value from the given path. The path is a property path with support for dot notation.
func (RawData) Int32 ¶
Int32 unmarshals an int32 value from the given path. The path is a property path with support for dot notation.
func (RawData) Int64 ¶
Int64 unmarshals an int64 value from the given path. The path is a property path with support for dot notation.
func (RawData) Int8 ¶
Int8 unmarshals an int8 value from the given path. The path is a property path with support for dot notation.
func (RawData) Map ¶
Map unmarshals a map[string]interface{} value from the given path. The path is a property path with support for dot notation.
func (RawData) Slice ¶
Slice unmarshals a []]interface{} value from the given path. The path is a property path with support for dot notation.
func (RawData) String ¶
String unmarshals a string value from the given path. The path is a property path with support for dot notation.
func (RawData) Uint ¶
Uint unmarshals an uint value from the given path. The path is a property path with support for dot notation.
func (RawData) Uint16 ¶
Uint16 unmarshals an uint16 value from the given path. The path is a property path with support for dot notation.
func (RawData) Uint32 ¶
Uint32 unmarshals an uint32 value from the given path. The path is a property path with support for dot notation.