utils

package
v0.0.0-...-ba29e81 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bounded

func Bounded(a, lower, upper int) int

func MaxInt

func MaxInt(a, b int) int

func MinInt

func MinInt(a, b int) int

func Modulo

func Modulo(a, b int) int

func RepositoryHostAndSlug

func RepositoryHostAndSlug(repositoryURL string) (string, string, error)

func XDGConfigLocations

func XDGConfigLocations(filename string) []string

Return possible locations of configuration files based on https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

Types

type NullDuration

type NullDuration struct {
	Valid    bool
	Duration time.Duration
}

func NullSub

func NullSub(after NullTime, before NullTime) NullDuration

func (NullDuration) String

func (d NullDuration) String() string

type NullString

type NullString struct {
	Valid  bool
	String string
}

type NullTime

type NullTime struct {
	Valid bool
	Time  time.Time
}

func MaxNullTime

func MaxNullTime(times ...NullTime) NullTime

func MinNullTime

func MinNullTime(times ...NullTime) NullTime

func NullTimeFromString

func NullTimeFromString(s string) (t NullTime, err error)

func NullTimeFromTime

func NullTimeFromTime(t *time.Time) NullTime

type PollingStrategy

type PollingStrategy struct {
	InitialInterval time.Duration
	Multiplier      float64
	Randomizer      float64
	MaxInterval     time.Duration
	Forever         bool
}

func NewPollingStrategy

func NewPollingStrategy(initial int, max int, forever bool, d PollingStrategy) (PollingStrategy, error)

func (PollingStrategy) NextInterval

func (s PollingStrategy) NextInterval(i time.Duration) time.Duration

Jump to

Keyboard shortcuts

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