server

package
v0.0.0-...-617f325 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMainMeter

func GetMainMeter(ctx context.Context) (spinusdb.GetMainMeterRow, bool)

func GetSubMeter

func GetSubMeter(ctx context.Context) (spinusdb.GetSubMeterRow, bool)

func UserID

func UserID(ctx context.Context) (int32, bool)

func WithCacheControl

func WithCacheControl(h http.Handler, maxAge int) http.Handler

Types

type Address

type Address string

type BreakPoints

type BreakPoints [][3]time.Time

func (BreakPoints) Len

func (bp BreakPoints) Len() int

func (BreakPoints) Less

func (bp BreakPoints) Less(i, j int) bool

func (BreakPoints) Swap

func (bp BreakPoints) Swap(i, j int)

type ConsumedEnergyPrice

type ConsumedEnergyPrice float64

type Email

type Email string

type LogInFormData

type LogInFormData struct {
	GeneralError  string
	Username      string
	UsernameError string
	Password      string
	PasswordError string
}

type MainMeterBillingCreateTmplData

type MainMeterBillingCreateTmplData struct {
	MainMeterBillingFormData
	Upper MainMeterTmplData
}

type MainMeterBillingFormData

type MainMeterBillingFormData struct {
	GeneralError    string
	MaxDayDiff      string
	MaxDayDiffError string
	BillingPeriods  []*MainMeterBillingPeriodFormData
}

func NewMainMeterBillingFormData

func NewMainMeterBillingFormData() MainMeterBillingFormData

type MainMeterBillingListTmplData

type MainMeterBillingListTmplData struct {
	Upper MainMeterTmplData
}

type MainMeterBillingPeriodFormData

type MainMeterBillingPeriodFormData struct {
	BeginDate                string
	BeginDateError           string
	EndDate                  string
	EndDateError             string
	BeginReadingValue        string
	BeginReadingValueError   string
	EndReadingValue          string
	EndReadingValueError     string
	ConsumedEnergyPrice      string
	ConsumedEnergyPriceError string
	ServicePrice             string
	ServicePriceError        string
}

type MainMeterFormData

type MainMeterFormData struct {
	GeneralError string
	MeterID      string
	MeterIDError string
	Energy       string
	EnergyError  string
	Address      string
	AddressError string
}

type MainMeterID

type MainMeterID string

type MainMeterOverviewTmplData

type MainMeterOverviewTmplData struct {
	spinusdb.GetMainMeterRow
	Upper MainMeterTmplData
}

type MainMeterTmplData

type MainMeterTmplData struct {
	ID int32
}

type MaxDayDiff

type MaxDayDiff int32

type Password

type Password string

type Reading

type Reading struct {
	Value float64
	Time  time.Time
	Valid bool
}

type ReadingValue

type ReadingValue float64

type Server

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

func New

func New(config *conf.Conf) (*Server, error)

func (*Server) Close

func (s *Server) Close() error

func (*Server) HandleForbidden

func (s *Server) HandleForbidden(w http.ResponseWriter, r *http.Request)

func (*Server) HandleGetIndex

func (s *Server) HandleGetIndex(w http.ResponseWriter, r *http.Request)

func (*Server) HandleGetLogIn

func (s *Server) HandleGetLogIn(w http.ResponseWriter, r *http.Request)

func (*Server) HandleGetMainMeterBillingCreate

func (s *Server) HandleGetMainMeterBillingCreate(w http.ResponseWriter, r *http.Request)

func (*Server) HandleGetMainMeterBillingList

func (s *Server) HandleGetMainMeterBillingList(w http.ResponseWriter, r *http.Request)

func (*Server) HandleGetMainMeterCreate

func (s *Server) HandleGetMainMeterCreate(w http.ResponseWriter, r *http.Request)

func (*Server) HandleGetMainMeterList

func (s *Server) HandleGetMainMeterList(w http.ResponseWriter, r *http.Request)

func (*Server) HandleGetMainMeterOverview

func (s *Server) HandleGetMainMeterOverview(w http.ResponseWriter, r *http.Request)

func (*Server) HandleGetSignUp

func (s *Server) HandleGetSignUp(w http.ResponseWriter, r *http.Request)

func (*Server) HandleGetSubMeterCreate

func (s *Server) HandleGetSubMeterCreate(w http.ResponseWriter, r *http.Request)

func (*Server) HandleGetSubMeterList

func (s *Server) HandleGetSubMeterList(w http.ResponseWriter, r *http.Request)

func (*Server) HandleGetSubMeterOverview

func (s *Server) HandleGetSubMeterOverview(w http.ResponseWriter, r *http.Request)

func (*Server) HandleGetSubMeterReadingCreate

func (s *Server) HandleGetSubMeterReadingCreate(w http.ResponseWriter, r *http.Request)

func (*Server) HandleGetSubMeterReadingList

func (s *Server) HandleGetSubMeterReadingList(w http.ResponseWriter, r *http.Request)

func (*Server) HandleInternalServerError

func (s *Server) HandleInternalServerError(w http.ResponseWriter, r *http.Request, err error)

func (*Server) HandleNotAllowed

func (s *Server) HandleNotAllowed(w http.ResponseWriter, r *http.Request)

func (*Server) HandleNotFound

func (s *Server) HandleNotFound(w http.ResponseWriter, r *http.Request)

func (*Server) HandlePostLogIn

func (s *Server) HandlePostLogIn(w http.ResponseWriter, r *http.Request)

func (*Server) HandlePostLogOut

func (s *Server) HandlePostLogOut(w http.ResponseWriter, r *http.Request)

func (*Server) HandlePostMainMeterBillingCreate

func (s *Server) HandlePostMainMeterBillingCreate(w http.ResponseWriter, r *http.Request)

func (*Server) HandlePostMainMeterCreate

func (s *Server) HandlePostMainMeterCreate(w http.ResponseWriter, r *http.Request)

func (*Server) HandlePostSignUp

func (s *Server) HandlePostSignUp(w http.ResponseWriter, r *http.Request)

func (*Server) HandlePostSubMeterCreate

func (s *Server) HandlePostSubMeterCreate(w http.ResponseWriter, r *http.Request)

func (*Server) HandlePostSubMeterReadingCreate

func (s *Server) HandlePostSubMeterReadingCreate(w http.ResponseWriter, r *http.Request)

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

func (*Server) WithMainMeter

func (s *Server) WithMainMeter(h http.Handler) http.Handler

func (*Server) WithRequiredLogin

func (s *Server) WithRequiredLogin(h http.Handler) http.Handler

func (*Server) WithSubMeter

func (s *Server) WithSubMeter(h http.Handler) http.Handler

func (*Server) WithUserID

func (s *Server) WithUserID(h http.Handler) http.Handler

type ServicePrice

type ServicePrice struct {
	Float64 float64
	Valid   bool
}

type SignUpFormData

type SignUpFormData struct {
	GeneralError        string
	Username            string
	UsernameError       string
	Email               string
	EmailError          string
	Password            string
	PasswordError       string
	RepeatPasswordError string
}

type SubMeterCreateTmplData

type SubMeterCreateTmplData struct {
	SubMeterFormData
	Upper MainMeterTmplData
}

type SubMeterFormData

type SubMeterFormData struct {
	GeneralError string
	MeterID      string
	MeterIDError string
}

type SubMeterID

type SubMeterID string

type SubMeterListTmplData

type SubMeterListTmplData struct {
	SubMeters []spinusdb.ListSubMetersRow
	Upper     MainMeterTmplData
}

type SubMeterOverviewTmplData

type SubMeterOverviewTmplData struct {
	spinusdb.GetSubMeterRow
	Upper SubMeterTmplData
}

type SubMeterReadingCreateTmplData

type SubMeterReadingCreateTmplData struct {
	SubMeterReadingFormData
	Upper SubMeterTmplData
}

type SubMeterReadingFormData

type SubMeterReadingFormData struct {
	GeneralError      string
	ReadingValue      string
	ReadingValueError string
	ReadingDate       string
	ReadingDateError  string
}

type SubMeterReadingListTmplData

type SubMeterReadingListTmplData struct {
	SubMeterReadings []spinusdb.SubMeterReading
	Upper            SubMeterTmplData
}

type SubMeterTmplData

type SubMeterTmplData struct {
	MainMeterID int32
	Subid       int32
}

type Time

type Time struct {
	time.Time
}

type Upper

type Upper struct {
	UserLoggedIn bool
}

type Username

type Username string

Jump to

Keyboard shortcuts

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