countermap

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2020 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

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

Counter tracks values for unique keys

func NewCounter

func NewCounter() *Counter

func (*Counter) Dec

func (c *Counter) Dec(key string)

Dec decrements the counter by 1

func (*Counter) DecBy

func (c *Counter) DecBy(key string, amt int)

DecBy decrements the counter by the given amount

func (*Counter) Delete

func (c *Counter) Delete(key string)

Delete removes the counter

func (*Counter) Get

func (c *Counter) Get(key string) (int, bool)

Get returns the current value of the counter, and if it exists

func (*Counter) Inc

func (c *Counter) Inc(key string)

Inc increments the counter by 1

func (*Counter) IncBy

func (c *Counter) IncBy(key string, amt int)

IncBy increments the counter by the given amount

func (*Counter) Reset

func (c *Counter) Reset(key string)

Reset sets the counter to zero

func (*Counter) Set

func (c *Counter) Set(key string, to int)

Set the counter to the given amount

func (*Counter) Start

func (c *Counter) Start()

Start a counter message handler goroutine

func (*Counter) Stop

func (c *Counter) Stop()

Stop a counter message handler goroutine

Jump to

Keyboard shortcuts

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