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 ¶
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.
Click to show internal directories.
Click to hide internal directories.