context

package
v0.0.0-...-cec6815 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2019 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Overview

Context package defines primitives for generic context handling during execution.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	AWSSession *session.Session

	DDBSession *dynamodb.DynamoDB

	DBUserTable string

	DBWarnTable string

	// Application configuration
	Cfg *config.Config
}

Context holds current execution details.

func New

func New() *Context

New creates a fresh Context.

type ErrorMessage

type ErrorMessage struct {
	Message string `json:"message"`
}

ErrorMessage defines the message structure returned when an error happens.

type Handler

type Handler struct {
	C *Context
	H func(*Context, http.ResponseWriter, *http.Request) (int, error)
}

Handler is an abstraction layer to standardize web API returns, if an error happens.

func (Handler) ServeHTTP

func (fn Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP is a wrapper around web API calls, that adds a default Content-Type and formats outgoing error messages.

type InitialContext

type InitialContext struct {
	// --ip IP address of local webserver
	WebserverIp string

	// --port Port number of local webserver
	WebserverPort uint

	// --config Config file for local execution
	ConfigFile string

	// --webserver was set
	LocalExecution bool
}

InitialContext holds the input parameter details at the start of execution.

func NewInitialContext

func NewInitialContext() *InitialContext

NewInitialContext creates a fresh InitialContext.

Jump to

Keyboard shortcuts

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