helper

package
Version: v0.0.0-...-d72ca28 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DateFormat1 = "02-01-2006 15:04:05"
	DateFormat2 = "02-01-2006 04:05."
	DateFormat3 = "02-01-06 15:04:05"
	DateFormat4 = "01-02-06 15:04:05"
	DateFormat5 = "2-1-2006 15:4:5"
)

Functions

func ErrorHandler

func ErrorHandler(e error, position string)

func ErrorLog

func ErrorLog(e error, position string, errorList []error) []error

func FirstDayOfISOWeek

func FirstDayOfISOWeek(year int, week int, timezone *time.Location) time.Time

func GetConnRealtime

func GetConnRealtime() dbox.IConnection

func GetCorrelation

func GetCorrelation(Data1, Data2 tk.M) float64

func GetCovariance

func GetCovariance(x, y []float64) float64

func GetDataDateAvailable

func GetDataDateAvailable(collectionName string, timestampColumn string, where *dbox.Filter, ctx dbox.IConnection) (min time.Time, max time.Time, err error)

func GetDateCell

func GetDateCell(strDate string) (result time.Time, e error)

func GetDateCellAuto

func GetDateCellAuto(cellDate *xlsx.Cell, cellTime *xlsx.Cell) (result time.Time, e error)

func GetDateRange

func GetDateRange(dt time.Time, isBefore bool) (result time.Time)

func GetDayInYear

func GetDayInYear(year int) tk.M

func GetDaysNoByQuarter

func GetDaysNoByQuarter(year int, qtr int, lastDate time.Time) int

func GetFloatCell

func GetFloatCell(cell *xlsx.Cell) (result float64, e error)

func GetNormalAddDateMonth

func GetNormalAddDateMonth(dt time.Time, month int) (res time.Time)

func GetPeriodBackByDate

func GetPeriodBackByDate(periodType string, lastDate time.Time, noPeriodBack int) time.Time

periodType:

YEAR => in Years
QTR => in Quarters
MONTH => in Months
WEEK => in Weeks
DAY	=> in Days

func GetPowerCurveByWs

func GetPowerCurveByWs(conn dbox.IConnection, _model string, avgws float64) (cpowerspc float64, cpowerstd float64, err error)

func GetPowerCurveTkMSource

func GetPowerCurveTkMSource(pcSrcTkM []tk.M, avgws float64) (cpowerspc float64, cpowerstd float64)

func GetStandardDev

func GetStandardDev(af []float64) float64

func LeftPad2Len

func LeftPad2Len(s string, padStr string, overallLen int) string

func LogProcess

func LogProcess(processName string, totalData float64, totalDone float64)

func PopulateReducesAvailability

func PopulateReducesAvailability(ctx *orm.DataContext) (brakeReducesAvailability map[string]bool, e error)

func PopulateTurbines

func PopulateTurbines(_db dbox.IConnection, project string) (tkturbines tk.M)

func PopulateTurbinesCapacity

func PopulateTurbinesCapacity(_db dbox.IConnection, project string) (tkturbines tk.M)

func ReadConfig

func ReadConfig() map[string]string

func ReadJson

func ReadJson(source string, result interface{})

func ReverseMonthDate

func ReverseMonthDate(date time.Time) (result time.Time, e error)

func Round

func Round(f float64) float64

func RoundPlus

func RoundPlus(f float64, places int) float64

func RoundUp

func RoundUp(val float64, roundOn float64, places int) (newVal float64)

func UpperFirstLetter

func UpperFirstLetter(str string) string

func WriteErrors

func WriteErrors(errorList tk.M, fileName string) (e error)

Types

type DateInfo

type DateInfo struct {
	DateId    time.Time
	MonthId   int
	MonthDesc string
	QtrId     int
	QtrDesc   string
	WeekId    int    `bson:"weekid,omitempty" json:"weekid,omitempty"`
	WeekDesc  string `bson:"weekdesc,omitempty" json:"weekdesc,omitempty"`
	Year      int
}

func GetDateInfo

func GetDateInfo(t time.Time) DateInfo

func MonthIDToDateInfo

func MonthIDToDateInfo(mid int) (dateInfo DateInfo)

type SortDirection

type SortDirection struct {
	Field string
	Dir   string
}

Jump to

Keyboard shortcuts

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