Documentation
¶
Index ¶
- func APIGatewayV2Request(method, path string, opts HTTPEventOptions) events.APIGatewayV2HTTPRequest
- func DynamoDBStreamEvent(opts DynamoDBStreamEventOptions) events.DynamoDBEvent
- func EventBridgeEvent(opts EventBridgeEventOptions) events.EventBridgeEvent
- func LambdaFunctionURLRequest(method, path string, opts HTTPEventOptions) events.LambdaFunctionURLRequest
- func SQSEvent(opts SQSEventOptions) events.SQSEvent
- func WebSocketEvent(opts WebSocketEventOptions) events.APIGatewayWebsocketProxyRequest
- type DynamoDBStreamEventOptions
- type DynamoDBStreamRecordOptions
- type Env
- func (e *Env) App(opts ...apptheory.Option) *apptheory.App
- func (e *Env) Invoke(ctx context.Context, app *apptheory.App, req apptheory.Request) apptheory.Response
- func (e *Env) InvokeAPIGatewayV2(ctx context.Context, app *apptheory.App, event events.APIGatewayV2HTTPRequest) events.APIGatewayV2HTTPResponse
- func (e *Env) InvokeDynamoDBStream(ctx context.Context, app *apptheory.App, event events.DynamoDBEvent) events.DynamoDBEventResponse
- func (e *Env) InvokeEventBridge(ctx context.Context, app *apptheory.App, event events.EventBridgeEvent) (any, error)
- func (e *Env) InvokeLambdaFunctionURL(ctx context.Context, app *apptheory.App, event events.LambdaFunctionURLRequest) events.LambdaFunctionURLResponse
- func (e *Env) InvokeSQS(ctx context.Context, app *apptheory.App, event events.SQSEvent) events.SQSEventResponse
- func (e *Env) InvokeWebSocket(ctx context.Context, app *apptheory.App, ...) events.APIGatewayProxyResponse
- type EventBridgeEventOptions
- type FakeStreamerClient
- func (f *FakeStreamerClient) DeleteConnection(_ context.Context, connectionID string) error
- func (f *FakeStreamerClient) GetConnection(_ context.Context, connectionID string) (streamer.Connection, error)
- func (f *FakeStreamerClient) PostToConnection(_ context.Context, connectionID string, data []byte) error
- type HTTPEventOptions
- type ManualClock
- type ManualIDGenerator
- type SQSEventOptions
- type SQSMessageOptions
- type StreamerCall
- type WebSocketEventOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIGatewayV2Request ¶
func APIGatewayV2Request(method, path string, opts HTTPEventOptions) events.APIGatewayV2HTTPRequest
func DynamoDBStreamEvent ¶ added in v0.2.0
func DynamoDBStreamEvent(opts DynamoDBStreamEventOptions) events.DynamoDBEvent
func EventBridgeEvent ¶ added in v0.2.0
func EventBridgeEvent(opts EventBridgeEventOptions) events.EventBridgeEvent
func LambdaFunctionURLRequest ¶
func LambdaFunctionURLRequest(method, path string, opts HTTPEventOptions) events.LambdaFunctionURLRequest
func SQSEvent ¶ added in v0.2.0
func SQSEvent(opts SQSEventOptions) events.SQSEvent
func WebSocketEvent ¶ added in v0.2.0
func WebSocketEvent(opts WebSocketEventOptions) events.APIGatewayWebsocketProxyRequest
Types ¶
type DynamoDBStreamEventOptions ¶ added in v0.2.0
type DynamoDBStreamEventOptions struct {
StreamARN string
Records []DynamoDBStreamRecordOptions
}
type DynamoDBStreamRecordOptions ¶ added in v0.2.0
type Env ¶
type Env struct {
Clock *ManualClock
IDs *ManualIDGenerator
}
Env is a deterministic local test environment for AppTheory apps.
func NewWithTime ¶
func (*Env) InvokeAPIGatewayV2 ¶
func (e *Env) InvokeAPIGatewayV2( ctx context.Context, app *apptheory.App, event events.APIGatewayV2HTTPRequest, ) events.APIGatewayV2HTTPResponse
func (*Env) InvokeDynamoDBStream ¶ added in v0.2.0
func (e *Env) InvokeDynamoDBStream( ctx context.Context, app *apptheory.App, event events.DynamoDBEvent, ) events.DynamoDBEventResponse
func (*Env) InvokeEventBridge ¶ added in v0.2.0
func (*Env) InvokeLambdaFunctionURL ¶
func (e *Env) InvokeLambdaFunctionURL( ctx context.Context, app *apptheory.App, event events.LambdaFunctionURLRequest, ) events.LambdaFunctionURLResponse
func (*Env) InvokeWebSocket ¶ added in v0.2.0
func (e *Env) InvokeWebSocket( ctx context.Context, app *apptheory.App, event events.APIGatewayWebsocketProxyRequest, ) events.APIGatewayProxyResponse
type EventBridgeEventOptions ¶ added in v0.2.0
type FakeStreamerClient ¶ added in v0.2.0
type FakeStreamerClient struct {
Endpoint string
Calls []StreamerCall
Connections map[string]streamer.Connection
PostErr error
GetErr error
DeleteErr error
// contains filtered or unexported fields
}
func NewFakeStreamerClient ¶ added in v0.2.0
func NewFakeStreamerClient(endpoint string) *FakeStreamerClient
func (*FakeStreamerClient) DeleteConnection ¶ added in v0.2.0
func (f *FakeStreamerClient) DeleteConnection(_ context.Context, connectionID string) error
func (*FakeStreamerClient) GetConnection ¶ added in v0.2.0
func (f *FakeStreamerClient) GetConnection(_ context.Context, connectionID string) (streamer.Connection, error)
func (*FakeStreamerClient) PostToConnection ¶ added in v0.2.0
type HTTPEventOptions ¶
type HTTPEventOptions struct {
Query map[string][]string
Headers map[string]string
Cookies []string
Body []byte
IsBase64 bool
}
HTTPEventOptions configures synthetic HTTP events for local testing.
type ManualClock ¶
type ManualClock struct {
// contains filtered or unexported fields
}
ManualClock is a deterministic, mutable clock for tests.
func NewManualClock ¶
func NewManualClock(now time.Time) *ManualClock
func (*ManualClock) Now ¶
func (c *ManualClock) Now() time.Time
func (*ManualClock) Set ¶
func (c *ManualClock) Set(now time.Time)
type ManualIDGenerator ¶
type ManualIDGenerator struct {
// contains filtered or unexported fields
}
ManualIDGenerator is a deterministic, predictable ID generator for tests.
func NewManualIDGenerator ¶
func NewManualIDGenerator() *ManualIDGenerator
func (*ManualIDGenerator) NewID ¶
func (g *ManualIDGenerator) NewID() string
func (*ManualIDGenerator) Queue ¶
func (g *ManualIDGenerator) Queue(ids ...string)
func (*ManualIDGenerator) Reset ¶
func (g *ManualIDGenerator) Reset()
type SQSEventOptions ¶ added in v0.2.0
type SQSEventOptions struct {
QueueARN string
Records []SQSMessageOptions
}
type SQSMessageOptions ¶ added in v0.2.0
type StreamerCall ¶ added in v0.2.0
type WebSocketEventOptions ¶ added in v0.2.0
type WebSocketEventOptions struct {
RouteKey string
EventType string
ConnectionID string
DomainName string
Stage string
RequestID string
Body string
IsBase64 bool
Headers map[string]string
MultiValueHeaders map[string][]string
QueryStringParameters map[string]string
MultiValueQueryString map[string][]string
}
Click to show internal directories.
Click to hide internal directories.