util

package
v0.0.0-...-65a99ba Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const EnvPrefix = "GSD" //Go Stats D

EnvPrefix is the prefix of the inspected environment variables.

Variables

This section is empty.

Functions

func GetSubViper

func GetSubViper(v *viper.Viper, key string) *viper.Viper

func InitViper

func InitViper(v *viper.Viper, subViperName string)

InitViper sets up env var handling for a viper. This must be run on every created sub viper as these settings are not persisted to nested viper instances.

func NopWriteCloser

func NopWriteCloser(w io.Writer) io.WriteCloser

Types

type AlignedTicker

type AlignedTicker struct {
	C <-chan time.Time
	// contains filtered or unexported fields
}

AlignedTicker is a wrapper around time.Ticker will align the time on a specific interval. The first tick will always occur within interval, the caller should explicitly discard this on creation, or not. Instead of firing at: [T+1*interval, T+2*interval, T+3*interval, ...]

It will fire at: r = roundup(T, interval)+offset [r+1*interval, r+interval*2, r+3*interval, ...]

The time.Time sent to the channel is guaranteed to be r+offset+n*interval, rather than the actual time of firing.

func NewAlignedTicker

func NewAlignedTicker(interval, offset time.Duration) *AlignedTicker

func NewAlignedTickerWithContext

func NewAlignedTickerWithContext(ctx context.Context, interval, offset time.Duration) *AlignedTicker

func (*AlignedTicker) Stop

func (at *AlignedTicker) Stop()

Jump to

Keyboard shortcuts

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