pick

package
v1.8.1-0...-ed8303a Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	First           pickMode = 1 + iota // Always pick the first element (index = 0)
	RandomOnce                          // Pick random element once (any future Pick calls will return the same element)
	RandomEveryTime                     // Always Pick the random element
)

Variables

This section is empty.

Functions

func NewPicker

func NewPicker(maxIdx uint32, mode pickMode) *picker

Types

type StringsSlice

type StringsSlice struct {
	// contains filtered or unexported fields
}

func NewStringsSlice

func NewStringsSlice(items []string, mode pickMode) *StringsSlice

NewStringsSlice creates new StringsSlice.

func (*StringsSlice) Pick

func (s *StringsSlice) Pick() string

Pick an element from the strings slice.

type StringsSliceWithInterval

type StringsSliceWithInterval struct {
	// contains filtered or unexported fields
}

func NewStringsSliceWithInterval

func NewStringsSliceWithInterval(items []string, mode pickMode, interval time.Duration) *StringsSliceWithInterval

NewStringsSliceWithInterval creates new StringsSliceWithInterval.

func (*StringsSliceWithInterval) Close

func (s *StringsSliceWithInterval) Close() error

func (*StringsSliceWithInterval) Pick

func (s *StringsSliceWithInterval) Pick() string

Pick an element from the strings slice.

Jump to

Keyboard shortcuts

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