package
module
Version:
v0.1.3
Opens a new window with list of versions in this module.
Published: Feb 3, 2021
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Documentation
¶
Package rater is a sample, thread-safe container, suitable for use in some occasions
with grade requirements, e.g: priority ranking
Rater structure
NewRater new container instance.
func (r *Rater) ASC(fn func(int, interface{}))
ASC traverses in ascending order of 'rate'.
func (r *Rater) DESC(fn func(rate int, val interface{}))
DESC traverses in descending order of 'rate'.
func (r *Rater) Pop(val interface{})
Pop a value, if this value is not pushed, nothing will happen.
func (r *Rater) Push(val interface{}, rate ...int)
Push value, if the 'rate' is not assigned, the default 'rate' is 0,
if the value has been Pushed, the original rate will be overwritten.
func (r *Rater) Rate(rate int, fn func(val interface{}))
Rate iterate over the elements of a 'rate'
Source Files
¶
Click to show internal directories.
Click to hide internal directories.