server

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultHandler

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

func EnsureTable(ctx context.Context, db *dynamodb.DynamoDB, name string) error

EnsureTable creates the DynamoDB table if it does not exist. It is useful in test environments.

func Handle

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.

func LocalDB

func LocalDB() *dynamodb.DynamoDB

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 Args

type Args struct {
	DB                                   *dynamodb.DynamoDB
	TableName                            string
	APIGatewayManagementAPIClientFactory APIGatewayManagementAPIClientFactory
}

Args represent external dependencies of the server, which may be replaced in test environments.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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