-
Notifications
You must be signed in to change notification settings - Fork 0
/
entry.go
28 lines (25 loc) · 1.13 KB
/
entry.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
package lambdapb
import "github.com/aws/aws-lambda-go/lambda"
// Start takes a handler and talks to an internal Lambda endpoint to pass requests to the handler. If the
// handler does not match one of the supported types an appropriate error message will be returned to the caller.
// 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 satisfy the "context.Context" interface.
// * handler may return between 0 and two arguments.
// * if there are two return values, the second argument must be an error.
// * if there is one return value it must be an error.
//
// Valid function signature:
// func (context.Context, in ) (out, 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
func Start(handler interface{}) {
wrapped := NewHandler(handler)
lambda.StartHandler(wrapped)
}