dbModify

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UserParameters = QueryParameters{}

UserParameters

@Description: var to store parameters with each instance
View Source
var UtilCodes = map[string]string{
	"AECO":    "Atlantic City Electric Company",
	"APS":     "Potomac Edison - Allegheny Power",
	"BED":     "Eversource - Boston Edison",
	"BGE":     "Baltimore Gas and Electric",
	"CAMB":    "Eversource - Cambridge Electric",
	"CEI":     "Cleveland Electric",
	"CGE":     "Duke Energy",
	"CHGE":    "Central Hudson",
	"CILCO":   "Ameren Rate Zone II - CILCO",
	"CIPS":    "Ameren Rate Zone I - CIPS",
	"CMP":     "Central Maine Power",
	"COME":    "Eversource - Commonwealth Electric",
	"COMED":   "Commonwealth Edison",
	"CONE":    "Consolidated Edison",
	"CS":      "AEP - CS",
	"DELM":    "Conectiv Delmarva",
	"DELMDE":  "Delmarva",
	"DLCO":    "Duquesne Light Company",
	"DPL":     "Dayton Power and Light",
	"FGE":     "Unitil - Fitchburg Gas and Electric",
	"GSECO":   "Granite State Electric Co (Liberty Utilities)",
	"ILPWR":   "Ameren Rate Zone III - IP",
	"JCPL":    "Jersey Central Power & Light Company",
	"METED":   "Metropolitan Edison Company",
	"MSEL":    "National Grid - Massachusetts Electric Company",
	"MWST":    "Eversource - Western Massachusetts Electric",
	"NECO":    "Rhode Island Energy",
	"NHEC":    "New Hampshire Electric Co",
	"NIMO":    "National Grid - Niagara Mohawk",
	"NYOR":    "Orange and Rockland",
	"NYSEG":   "New York State Electric & Gas",
	"OE":      "Ohio Edison",
	"OPCO":    "AEP - OP",
	"PECO":    "PECO Energy",
	"PENELEC": "Pennsylvania Electric Company",
	"PEPCO":   "Potomac Electric Power Company",
	"PP":      "Pennsylvania Power Company",
	"PPL":     "Pennsylvania Power and Light, Inc.",
	"PSEG":    "Public Service Electric and Gas Company",
	"PSNH":    "Public Service Of New Hampshire",
	"RECO":    "Rockland Electric Company",
	"RGE":     "Rochester Gas & Electric",
	"TE":      "Toledo Edison",
	"UNITIL":  "Unitil Energy Systems",
	"WPP":     "Allegheny Power WPP",
}

UtilCodes

@Description: map of all valid utility codes and names

Functions

func GetUtilByCode

func GetUtilByCode(code string) string

GetUtilByCode

@Description: get utility name by shorthand code
@param code
@return string

func InitializeDatabase

func InitializeDatabase()

InitializeDatabase

@Description: initialize db - create table

func InsertMargin

func InsertMargin(entries []MatrixEntry, mils float32)

InsertMargin

@Description: adds margin to each entry in a []MatrixEntry and adjusts price accordingly
@param entries
@param mils

func LoadParameters

func LoadParameters(newParameters QueryParameters)

LoadParameters

@Description: load parameters into variable UserParameters
@param newParameters

func PrintParameters

func PrintParameters()

PrintParameters

@Description: print formatted parameters

func ProcessRows added in v1.0.3

func ProcessRows(rows [][]string) bool

ProcessRows

@Description: Processes matrix rows and inserts into database
@param rows
@return bool

func ReInitializeDatabase

func ReInitializeDatabase()

ReInitializeDatabase

@Description: initialize db with drop table statement

func SetDualBilling

func SetDualBilling(dualBilling bool)

SetDualBilling

@Description: update DualBilling in UserParameters - include dual billing
@param dualBilling

func SetFilePath

func SetFilePath(filePath string)

SetFilePath

@Description: updates FilePath in UserParameters - filepath of Excel file
@param filePath

func SetMils

func SetMils(mils float32)

SetMils

@Description: updates Mils in UserParameters - broker fee
@param mils

func SetStartDate

func SetStartDate(startDate string)

SetStartDate

@Description: updates StartDate in UserParameters - contract start month/year
@param startDate

func SetTerms

func SetTerms(terms []int)

SetTerms

@Description: update Terms in UserParameters - terms to include
@param terms

func SetUtil

func SetUtil(util string)

SetUtil

@Description: update Util in UserParameters - utility code
@param util

Types

type MatrixEntry

type MatrixEntry struct {
	Id                                                                       int
	ContractStart, State, Util, Zone, RateCode, ProductOption, BillingMethod string
	Term                                                                     int
	UsageLower, UsageMiddle, UsageUpper                                      float32
}

MatrixEntry

@Description: struct to store matrix pricing entry

func GetFilteredEntries

func GetFilteredEntries() []MatrixEntry

GetFilteredEntries

@Description: retrieve for all pricing entries in db based on parameters and convert to MatrixEntry structs
@return []MatrixEntry

func (MatrixEntry) MarshalEasyJSON

func (v MatrixEntry) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (MatrixEntry) MarshalJSON

func (v MatrixEntry) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*MatrixEntry) UnmarshalEasyJSON

func (v *MatrixEntry) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*MatrixEntry) UnmarshalJSON

func (v *MatrixEntry) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type QueryParameters

type QueryParameters struct {
	FilePath    string  `json:"filePath"`    // file path of Excel file
	Mils        float32 `json:"mils"`        // broker fee for report
	StartDate   string  `json:"startDate"`   // contract start month/year
	Util        string  `json:"util"`        // utility code
	DualBilling bool    `json:"dualBilling"` // include dual billing
	Terms       []int   `json:"terms"`       // terms to include
}

QueryParameters

@Description: struct to store parameters

func ReadJson

func ReadJson() QueryParameters

ReadJson

@Description: read parameters json file and convert to QueryParameters struct
@return QueryParameters

func (QueryParameters) MarshalEasyJSON

func (v QueryParameters) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (QueryParameters) MarshalJSON

func (v QueryParameters) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*QueryParameters) UnmarshalEasyJSON

func (v *QueryParameters) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*QueryParameters) UnmarshalJSON

func (v *QueryParameters) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Jump to

Keyboard shortcuts

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