MCPcopy Index your code
hub / github.com/aws/aws-lambda-go / newHandler

Function newHandler

lambda/handler.go:163–190  ·  view source on GitHub ↗
(handlerFunc interface{}, options ...Option)

Source from the content-addressed store, hash-verified

161}
162
163func newHandler(handlerFunc interface{}, options ...Option) *handlerOptions {
164 if h, ok := handlerFunc.(*handlerOptions); ok {
165 return h
166 }
167 pool := &sync.Pool{}
168 pool.New = func() interface{} {
169 return &jsonOutBuffer{pool, bytes.NewBuffer(nil)}
170 }
171 h := &handlerOptions{
172 baseContext: context.Background(),
173 contextValues: map[interface{}]interface{}{},
174 jsonResponseEscapeHTML: false,
175 jsonResponseIndentPrefix: "",
176 jsonResponseIndentValue: "",
177 jsonOutBufferPool: pool,
178 }
179 for _, option := range options {
180 option(h)
181 }
182 for k, v := range h.contextValues {
183 h.baseContext = context.WithValue(h.baseContext, k, v)
184 }
185 if h.enableSIGTERM {
186 enableSIGTERM(h.sigtermCallbacks)
187 }
188 h.handlerFunc = reflectHandler(handlerFunc, h)
189 return h
190}
191
192type handlerFunc func(context.Context, []byte) (io.Reader, error)
193

Callers 9

startRuntimeAPILoopFunction · 0.85
NewHandlerWithOptionsFunction · 0.85
NewFunctionFunction · 0.85
StartHandlerFuncFunction · 0.85
StartWithOptionsFunction · 0.85
TestInvokesFunction · 0.85

Calls 2

enableSIGTERMFunction · 0.85
reflectHandlerFunction · 0.85

Used in the wild real call sites across dependent graphs

searching dependent graphs…