appsyncevents

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package appsyncevents routes native Lambda AppSync Events invocations.

Index

Constants

View Source
const MaxEventSize = 240 * 1024

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event = map[string]any

Event retains the original JSON envelope, including unknown identity and request fields. Handlers share this envelope during individual publication and must treat it as read-only.

type NamedError

type NamedError struct {
	Name, Message string
	Cause         error
}

NamedError supplies the JavaScript error name used in response envelopes.

func (*NamedError) Error

func (e *NamedError) Error() string

func (*NamedError) ErrorName

func (e *NamedError) ErrorName() string

func (*NamedError) Unwrap

func (e *NamedError) Unwrap() error

type Options

type Options struct {
	WarnOnLargePayload bool
	// Diagnostic may be called concurrently. Registration uses context.Background;
	// resolution and handler errors retain the invocation context. Callbacks run unlocked.
	Diagnostic func(ctx context.Context, level, message string, err error)
}

type PublishHandler

type PublishHandler func(context.Context, any, Event) (any, error)

type PublishOptions

type PublishOptions struct{ Aggregate bool }

type Resolver

type Resolver struct{ *Router }

func New

func New(options Options) *Resolver

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, input any) (any, error)

Resolve accepts a JSON-decoded Lambda event. The context is passed unchanged to handlers and diagnostics. Per-item handlers run concurrently; output order is stable. Invalid events and successful subscriptions return nil (JSON null in Go Lambda).

type Router

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

Router stores separate publish and subscribe registries. Register routes before serving requests: successful lookup caches intentionally retain old registrations.

func NewRouter

func NewRouter(options Options) *Router

func (*Router) OnPublish

func (r *Router) OnPublish(path string, handler PublishHandler, options ...PublishOptions)

func (*Router) OnSubscribe

func (r *Router) OnSubscribe(path string, handler SubscribeHandler)

type SubscribeHandler

type SubscribeHandler func(context.Context, Event) error

type UnauthorizedError

type UnauthorizedError = UnauthorizedException

UnauthorizedError is the Go-style alias; it retains the runtime exception type name.

type UnauthorizedException

type UnauthorizedException struct {
	Message string
	Cause   error
}

UnauthorizedException preserves the Go Lambda SDK's reflected errorType as well as the reference response name. Aggregate/subscription handlers propagate it; individual publication formats it in that item's error response.

func (*UnauthorizedException) Error

func (e *UnauthorizedException) Error() string

func (*UnauthorizedException) ErrorName

func (e *UnauthorizedException) ErrorName() string

func (*UnauthorizedException) Unwrap

func (e *UnauthorizedException) Unwrap() error

type Undefined

type Undefined struct{}

Undefined omits the immediate payload/events property instead of encoding JSON null.

Jump to

Keyboard shortcuts

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