Documentation ¶
Index ¶
- func DefaultHandler(ctx context.Context, req events.APIGatewayWebsocketProxyRequest) (resp events.APIGatewayProxyResponse, err error)
- func EnsureTable(ctx context.Context, db *dynamodb.DynamoDB, name string) error
- func Handle(ctx context.Context, req events.APIGatewayWebsocketProxyRequest, args Args) (resp events.APIGatewayProxyResponse, err error)
- func LocalDB() *dynamodb.DynamoDB
- type AIGameState
- type APIGatewayManagementAPIClient
- type APIGatewayManagementAPIClientFactory
- type Args
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultHandler ¶
func DefaultHandler(ctx context.Context, req events.APIGatewayWebsocketProxyRequest) (resp events.APIGatewayProxyResponse, err error)
DefaultHandler is an AWS Lambda handler that uses default arguments, as it would in a real deployment environment. It can be invoked with lambda.Start(server.DefaultHandler).
func EnsureTable ¶
EnsureTable creates the DynamoDB table if it does not exist. It is useful in test environments.
func Handle ¶
func Handle(ctx context.Context, req events.APIGatewayWebsocketProxyRequest, args Args) (resp events.APIGatewayProxyResponse, err error)
Handle is the main entrypoint of the server logic. It looks similar to an AWS Lambda handler function signature, but has a final argument args, which can be used to configure external dependencies in test environments.
Types ¶
type AIGameState ¶
type AIGameState interface { // Score evaluates the desirability of a state from the perspective of the AI player. Score() float64 // AITurn returns true if the next move will be performed by the AI player. AITurn() bool // MoveCount returns the number of moves possible in the current state. MoveCount() int // Move performs the move at the given index and returns the next state after the move. Move(int) AIGameState }
AIGameState represents the state of a game and implements game domain-specific logic.
type APIGatewayManagementAPIClient ¶
type APIGatewayManagementAPIClient interface {
PostToConnectionWithContext(ctx aws.Context, input *apigatewaymanagementapi.PostToConnectionInput, opts ...request.Option) (*apigatewaymanagementapi.PostToConnectionOutput, error)
}
type APIGatewayManagementAPIClientFactory ¶
type APIGatewayManagementAPIClientFactory func(events.APIGatewayWebsocketProxyRequestContext) APIGatewayManagementAPIClient
Source Files ¶
Click to show internal directories.
Click to hide internal directories.