server

package
v1.3.10 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package server runs the http server after initializing the database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AboutRequester

type AboutRequester interface {
	PreviousDeployment() (*request.Deployment, error)
}

AboutRequester gets the previous deployment info for the app.

type AdminTab

type AdminTab struct {
	Name   string
	Action string
	Data   []interface{} // each template knows what data to expect
}

AdminTab provides tabs with admin tasks.

func (AdminTab) GetID

func (at AdminTab) GetID() string

GetID implements the Tab interface for AdminTab

func (AdminTab) GetName

func (at AdminTab) GetName() string

GetName implements the Tab interface for AdminTab

type Config

type Config struct {
	DisplayName    string
	Port           string
	NflAppKey      string
	LogRequestURIs bool
	HtmlFS         fs.FS
	JavascriptFS   fs.FS
	StaticFS       fs.FS
}

Config contains fields which describe the server

func (Config) New

func (cfg Config) New(log *log.Logger, ds ServerDatastore, httpClient request.HTTPClient) (*Server, error)

New validates and creates a new Server from the config

type EtlStats

type EtlStats struct {
	// contains filtered or unexported fields
}

EtlStats contains ScoreCategories that were stored at a specific time

type Page

type Page struct {
	ApplicationName string
	Title           string
	Tabs            []Tab

	ShowTabs     bool
	Sports       []SportEntry
	TimesMessage TimesMessage
	PageLoadTime time.Time
	// contains filtered or unexported fields
}

Page is a page that gets rendered by the main template

type Server

type Server struct {
	Config
	// contains filtered or unexported fields
}

Server contains data to serve pages for the user.

func (Server) Run

func (s Server) Run() error

Run configures and starts the server

type ServerDatastore

type ServerDatastore interface {
	GetYears(st db.SportType) ([]db.Year, error)
	// contains filtered or unexported methods
}

ServerDatastore provides a way for the server to store and retrieve data.

type SportEntry

type SportEntry struct {
	URL  string
	Name string
	// contains filtered or unexported fields
}

SportEntry contains the url and name of a SportType

type StatsTab

type StatsTab struct {
	ScoreCategory request.ScoreCategory
	ExportURL     string
}

StatsTab provides stats information

func (StatsTab) GetID

func (st StatsTab) GetID() string

GetID implements the Tab interface for StatsTab

func (StatsTab) GetName

func (st StatsTab) GetName() string

GetName implements the Tab interface for StatsTab

type Tab

type Tab interface {
	GetName() string
	GetID() string
}

Tab is a tab which gets rendered by the main template

type TimesMessage

type TimesMessage struct {
	Messages []string
	Times    []time.Time
}

TimesMessage contains times to insert between messages

Jump to

Keyboard shortcuts

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