Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@

# Go workspace file
go.work
go.work.sum
4 changes: 2 additions & 2 deletions endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (

// Endpoint is the generic representation of any endpoint
// which takes a request and returns a reponse.
type Endpoint[TIn, TOut any] func(ctx context.Context, req TIn) (TOut, error)
type Endpoint[TIn, TOut any] = func(ctx context.Context, req TIn) (TOut, error)

// Middleware is an [Endpoint] middleware which can be used to wrap
// around endpoints and decorate them with auxillary functionality, like
// request logging, instrumentation, context enrichment etc.
type Middleware[TIn, TOut any] func(next Endpoint[TIn, TOut]) Endpoint[TIn, TOut]
type Middleware[TIn, TOut any] = func(next Endpoint[TIn, TOut]) Endpoint[TIn, TOut]

// Chain is a convenience function to chain multiple [Middleware]s together
// and finally wraps an [Endpoint].
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/jan-xyz/box

go 1.20
go 1.24

toolchain go1.24.0

require (
github.com/aws/aws-lambda-go v1.47.0
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ4
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
Expand Down
2 changes: 1 addition & 1 deletion transports/github.com/aws/aws-lambda-go/cloudwatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

type CloudWatchEventTransport = func(ctx context.Context, e *events.CloudWatchEvent) (any, error)

func NewClouadWatchEventTransport[TIn, TOut any](
func NewCloudWatchEventTransport[TIn, TOut any](
decode func(*events.CloudWatchEvent) (TIn, error),
endpoint box.Endpoint[TIn, TOut],
) CloudWatchEventTransport {
Expand Down
4 changes: 2 additions & 2 deletions transports/github.com/aws/aws-lambda-go/cloudwatch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

func makeSureCloudwatchTransportHasCorrectSignature() {
h := NewClouadWatchEventTransport(
h := NewCloudWatchEventTransport(
func(*events.CloudWatchEvent) (string, error) { return "", nil },
func(context.Context, string) (string, error) { return "", nil },
)
Expand Down Expand Up @@ -68,7 +68,7 @@ func Test_CloudWatchEvent_Handle(t *testing.T) {
}
for _, tC := range testCases {
t.Run(tC.desc, func(t *testing.T) {
h := NewClouadWatchEventTransport(
h := NewCloudWatchEventTransport(
tC.decodeFunc,
tC.ep,
)
Expand Down
Loading