webServer

package
v0.0.0-...-8f7a22b Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	DB         *sql.DB
	HTTPClient *http.Client
}

Controller struct

func CreateController

func CreateController(db *sql.DB) *Controller

CreateController - returns a populated controller object

func (*Controller) GetPasselState

func (c *Controller) GetPasselState(w http.ResponseWriter, r *http.Request)

GetPasselState - Get state of the entire passel

func (*Controller) GetPasselStateConsistency

func (c *Controller) GetPasselStateConsistency(w http.ResponseWriter, r *http.Request)

GetPasselStateConsistency - Get the state conistency of the passel

func (*Controller) GetState

func (c *Controller) GetState(w http.ResponseWriter, r *http.Request)

GetState - Get state of a single possum

func (*Controller) SetPasselState

func (c *Controller) SetPasselState(w http.ResponseWriter, r *http.Request)

SetPasselState - Set the state of the entire passel

func (*Controller) SetState

func (c *Controller) SetState(w http.ResponseWriter, r *http.Request)

SetState - set the possum state

type ControllerCreator

type ControllerCreator func(db *sql.DB) *Controller

ControllerCreator - controller creation function

type DBConn

type DBConn func(driverName string, connectionString string) (*sql.DB, error)

DBConn - database opening interface

type PossumStates

type PossumStates struct {
	PossumStates map[string]string `json:"possum_states"`
	Error        string            `json:"error"`
	Force        bool              `json:"force"`
}

PossumStates struct

type Server

type Server struct {
	Controller *Controller
}

Server struct

func CreateServer

func CreateServer(dbConnFunc DBConn, controllerCreator ControllerCreator) (*Server, error)

CreateServer - creates a server

func (*Server) Start

func (s *Server) Start() *mux.Router

Start - starts the web server

Jump to

Keyboard shortcuts

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