struct Rings contains nodes as slice of strings, count for the current ring position, xcount for the total amount of added entries and size for the maximum size of the "Ring".
type Rings struct {
// contains filtered or unexported fields
}
▹ Example
func Ring() *Rings
Ring returns a pointer to a new ring.
func (r *Rings) Get(from int) []string
Get returns a slice of strings from the given to the current position
func (r *Rings) GetSize() int
GetSize returns the max size of the Ring.
func (r *Rings) Init(i int)
Init sets the default values of the Ring.
func (r *Rings) Pos() (int, int)
Pos returns the current position and the number of overall added values
func (r *Rings) Push(n string) int
Push adds a string to the Ring and returns it position
func (r *Rings) SetSize(i int)
SetSize sets the maximum size of the Ring, this size must be greater then the current counter.
struct Stack contains nodes as slice of interfaces and a counter for the current position.
type Stack struct {
// contains filtered or unexported fields
}
▹ Example
func Fifo() *Stack
func Lifo() *Stack
Lifo returns a pointer to a new stack.
func (s *Stack) Add(n interface{})
func (s *Stack) Get() interface{}
func (s *Stack) IsEmpty() bool
func (s *Stack) Len() int
Len returns the current position in the Stack.
func (s *Stack) Pop() interface{}
Pop returns the last added value and decrease the position counter.
func (s *Stack) Push(n interface{})
Push adds a value to the Stack
func (s *Stack) ToFifo() *Stack
func (s *Stack) ToLifo() *Stack
func (s *Stack) Unset()
func (s *Stack) Val() []interface{}
type Stype int
const ( NIL Stype = iota LiFo FiFo )