lambda

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

README

Overview

GoDoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(handler interface{})

Start takes a handler, and talks to and internal Lambda endpoint to pass Invoke requests to the handler. If a handler does not match one of the supported types, the lambda package will respond to new invokes served by in internal endpoint with an appropriate error message. Start blocks, and does not return after being called.

Rules:

  • handler must be a function
  • handler may take between 0 and two arguments.
  • if there are two arguments, the first argument must implement "context.Context".
  • handler may return between 0 and two arguments.
  • if there are two return values, the second argument must implement "error".
  • if there is one return value it must implement "error".

Valid function signatures:

func ()
func () error
func (TIn) error
func () (TOut, error)
func (TIn) (TOut, error)
func (context.Context) error
func (context.Context, TIn) error
func (context.Context) (TOut, error)
func (context.Context, TIn) (TOut, error)

Where "TIn" and "TOut" are types compatible with the "encoding/json" standard library. See https://golang.org/pkg/encoding/json/#Unmarshal for how deserialization behaves

Types

type Function

type Function struct {
	// contains filtered or unexported fields
}

func (*Function) Invoke

func (fn *Function) Invoke(req *messages.InvokeRequest, response *messages.InvokeResponse) error

func (*Function) Ping

func (fn *Function) Ping(req *messages.PingRequest, response *messages.PingResponse) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL