AWS Lambda GoLang处理程序API
是否可以使用自定义API实现Lambda函数处理程序 对于aws lambda go,有效的处理程序是以下类型之一:AWS Lambda GoLang处理程序API,go,aws-lambda,amazon-kinesis,Go,Aws Lambda,Amazon Kinesis,是否可以使用自定义API实现Lambda函数处理程序 对于aws lambda go,有效的处理程序是以下类型之一: // func () // func () error // func (TIn) error // func () (TOut, error) // func (TIn) (TOut, error) // func (context.Context) error // func (context.Context, TIn) error // func (cont
// 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)
在我的例子中,TIn
是包含MySpecificType
作为有效负载的KinesEvent。
我正在寻找能够创建类型为的处理程序的方法(可能覆盖lambda.Start()
)
func(MySpecificType) error
目标是避免在每个lambda中从kinisevent中提取有效负载,并使处理程序源独立看起来解决方案非常简单。只需覆盖lambda.Start()方法: 然后:
// main.go
func Handler(m *MySpecificType, index int) error {
// ...
}
func main() {
<wherever_you_put_it_package>.Start(Handler)
// instead of lambda.Start(Handler)
}
//main.go
func处理程序(m*MySpecificType,index int)错误{
// ...
}
func main(){
.Start(处理程序)
//而不是lambda.Start(处理程序)
}
// main.go
func Handler(m *MySpecificType, index int) error {
// ...
}
func main() {
<wherever_you_put_it_package>.Start(Handler)
// instead of lambda.Start(Handler)
}