Documentation ¶
Index ¶
- Variables
- type Base
- func (b *Base) Add(s string) (bool, int, error)
- func (b *Base) AddAll(ss []string) ([]bool, []int, error)
- func (b *Base) Close() error
- func (b *Base) Closed() error
- func (b *Base) Contains(s string) bool
- func (b *Base) GetBias() (float64, error)
- func (b *Base) GetRandomlyDistributeNewItems() (bool, error)
- func (b *Base) Load(s string, g int) (bool, error)
- func (b *Base) LoadAll(ss []string, g int) ([]bool, error)
- func (b *Base) LoadDB(ss []string, gs []int) ([]bool, error)
- func (b *Base) MinGen() int
- func (b *Base) Next() (string, int, error)
- func (b *Base) NextN(n int) ([]string, int, error)
- func (b *Base) Remove(s string) (bool, error)
- func (b *Base) RemoveAll(ss []string) ([]bool, error)
- func (b *Base) SetBias(bi float64) error
- func (b *Base) SetRandomlyDistributeNewItems(rand bool) error
- func (b *Base) Size() (int, error)
- func (b *Base) UniqueN(n int) ([]string, int, error)
- func (b *Base) Values() ([]string, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrClosed = errors.New("strpick: method called on closed picker") ErrEmpty = errors.New("strpick: invalid Next on empty picker") ErrCorrupt = errors.New( "strpick: picker is in an invalid state, " + "do not use Unsafe from multiple goroutines") ErrOverflow = errors.New( "strpick: unrecoverable integer overflow, destroy and recreate the picker") ErrNegative = errors.New( "strpick: invalid negative number provided") ErrNaN = errors.New("strpick: unexpected NaN") ErrInsufficientUnique = errors.New( "strpick: UniqueN called with N larger than Size()") )
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
* The base implementation for all random string pickers.
Returns errors if it ever detects it has entered an inconsistent state as a result of concurrent access, but does not try to reliably detect misuse.
func NewBasePicker ¶
func NewBasePicker() *Base
func NewLeftmostOldestBasePicker ¶
func NewLeftmostOldestBasePicker() *Base
A Base picker that always returns the leftmost, oldest element For testing purposes only
func (*Base) GetRandomlyDistributeNewItems ¶
Maybe this could be exposed as a method on Picker
func (*Base) SetRandomlyDistributeNewItems ¶
Click to show internal directories.
Click to hide internal directories.