Documentation ¶
Overview ¶
Package apex provides Lambda support for Go via a Node.js shim and this package for operating over stdio.
Example ¶
package main import ( "encoding/json" "github.com/apex/apex" ) type Message struct { Hello string `json:"hello"` } func main() { apex.HandleFunc(func(event json.RawMessage, ctx *apex.Context) (interface{}, error) { return &Message{"world"}, nil }) }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleFunc ¶
func HandleFunc(h HandlerFunc)
HandleFunc handles Lambda events with the given handler function.
Types ¶
type Context ¶
type Context struct { InvokeID string `json:"invokeid"` RequestID string `json:"awsRequestId"` FunctionName string `json:"functionName"` FunctionVersion string `json:"functionVersion"` LogGroupName string `json:"logGroupName"` LogStreamName string `json:"logStreamName"` MemoryLimitInMB string `json:"memoryLimitInMB"` IsDefaultFunctionVersion bool `json:"isDefaultFunctionVersion"` ClientContext json.RawMessage `json:"clientContext"` }
Context represents the context data provided by a Lambda invocation.
type Handler ¶
type Handler interface {
Handle(json.RawMessage, *Context) (interface{}, error)
}
Handler handles Lambda events.
type HandlerFunc ¶
type HandlerFunc func(json.RawMessage, *Context) (interface{}, error)
HandlerFunc implements Handler.
func (HandlerFunc) Handle ¶
func (h HandlerFunc) Handle(event json.RawMessage, ctx *Context) (interface{}, error)
Handle Lambda event.
Directories ¶
Path | Synopsis |
---|---|
_examples
|
|
cmd
|
|
Package function implements higher-level functionality for dealing with Lambda functions.
|
Package function implements higher-level functionality for dealing with Lambda functions. |
Package kinesis provides structs for working with AWS Kinesis records.
|
Package kinesis provides structs for working with AWS Kinesis records. |
Package runtime provides interfaces for defining Lambda runtimes and appropriate shims for arbitrary language support.
|
Package runtime provides interfaces for defining Lambda runtimes and appropriate shims for arbitrary language support. |
Package shim provides a shim for running arbitrary languages on Lambda.
|
Package shim provides a shim for running arbitrary languages on Lambda. |
Click to show internal directories.
Click to hide internal directories.