moving_average

package
v0.0.0-...-07d62d3 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBufferSize = 500

DefaultBufferSize to use when storing the ring buffer

Variables

This section is empty.

Functions

func CalculateMovingAverage

func CalculateMovingAverage(key string) (int, error)

CalculateMovingAverage by taking the key given and calculating the current moving average by scanning the current list

func CalculateMovingAverageAndSumMaybePop

func CalculateMovingAverageAndSumMaybePop(key string, limit int, shouldPopIfExcess bool) (average int, sum int, err error)

CalculateMovingAverageAndSumMaybePop with the limit given, by getting a range over each item then popping anything that exceeds the limit if the flag is set

func CalculateMovingAverageRat

func CalculateMovingAverageRat(key string) (*big.Rat, error)

func StoreAndCalculate

func StoreAndCalculate(key string, x int) (int, error)

StoreAndCalculate the moving average by storing the amount then doing the calculation

func StoreAndCalculateRat

func StoreAndCalculateRat(key string, x *big.Rat) (*big.Rat, error)

func StoreValue

func StoreValue(key string, x interface{})

StoreValue by storing the value as-is in redis

Types

This section is empty.

Jump to

Keyboard shortcuts

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