util

package
v0.0.0-...-f43e618 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSpace

func AddSpace(s string) string

AddSpace Adds a space, if not present, between ASCII Characters and Non-ASCII Characters. Notice that Non-ASCII characters could be multibyte unicode sequence. For example, "中文english" -> "中文 english"

func CalcPooledStdDev

func CalcPooledStdDev(bundle1, bundle2 *StatsBundle) float64

func CalcStdDevFromQuantityBuckets

func CalcStdDevFromQuantityBuckets(quantityBuckets map[int]int, times int, isUnbiased bool) float64

func CalcTScore

func CalcTScore(bundle1, bundle2 *StatsBundle) float64

func ExtractIP

func ExtractIP(ctx *fiber.Ctx) string

func GetDayNum

func GetDayNum(t *time.Time, server string) int

func GetDayStartTime

func GetDayStartTime(t *time.Time, server string) int64

floor to 12am of the day of the given time and given server

func GetDayStartTimestampFromDayNum

func GetDayStartTimestampFromDayNum(dayNum int, server string) int64

func GetDropMatrixElementsMap

func GetDropMatrixElementsMap(elements []*model.DropMatrixElement, hasRangeID bool) map[int]map[int]map[int]*model.DropMatrixElement

func GetIntersection

func GetIntersection(timeRange1 *model.TimeRange, timeRange2 *model.TimeRange) *model.TimeRange

func GetStageIdItemIdMapFromDropInfos

func GetStageIdItemIdMapFromDropInfos(dropInfos []*model.DropInfo) map[int][]int

func GetStageIdsFromDropInfos

func GetStageIdsFromDropInfos(dropInfos []*model.DropInfo) []int

func GetTimeStampInServer

func GetTimeStampInServer(t *time.Time, server string) int64

func IsASCII

func IsASCII(s string) bool

func IsInt

func IsInt(s string) bool

func Must

func Must[T any](v T, err error) T

func NewValidator

func NewValidator() *validator.Validate

func NonNullString

func NonNullString(s string) bool

func RoundFloat64

func RoundFloat64(f float64, n int) float64

Types

type StatsBundle

type StatsBundle struct {
	N      int
	Avg    float64
	StdDev float64
}

func CombineTwoBundles

func CombineTwoBundles(bundle1, bundle2 *StatsBundle) *StatsBundle

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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