lambda

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(handler Handler)

Start starts the lambda handler.

Types

type Endpoint

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

Endpoint represent http-service endpoints.

func NewEndpoint

func NewEndpoint(svc service, logger *slog.Logger, addr string) *Endpoint

NewEndpoint returns new Endpoint instance.

func (*Endpoint) StartServer

func (e *Endpoint) StartServer(ctx context.Context) error

StartServer starts http-server.

type Error

type Error struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
}

func NewError

func NewError(status int, message string) *Error

func (Error) Error

func (e Error) Error() []byte

type Handler

type Handler func(ctx context.Context, payload []byte) ([]byte, error)

Handler is a user function that handles lambda requests.

type Server added in v0.1.0

type Server struct {
	proto.UnimplementedLambdaServerServer
	// contains filtered or unexported fields
}

Server is a wrapper for user Handler.

func (*Server) MakeRequest added in v0.1.0

func (h *Server) MakeRequest(ctx context.Context, payload *proto.Payload) (*proto.Payload, error)

type Service

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

Service is a service for lambda.

func NewService

func NewService(cfg *config.Config, log *slog.Logger, container builder) *Service

NewService returns new Service instance.

func (*Service) Create

func (s *Service) Create(ctx context.Context, name string, file io.ReadCloser) error

Create creates new lambda function. If function with the same name already exists, it will skip.

func (*Service) Init added in v0.1.0

func (s *Service) Init(ctx context.Context) error

Init initializes service. It gets all containers with name "go-lambda" and registers them in the service.

func (*Service) Invoke

func (s *Service) Invoke(ctx context.Context, name string, data []byte) ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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