tally-go

module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2020 License: MIT

README

= Simple Counters

image:https://img.shields.io/github/v/tag/foxcapades/tally-go[GitHub tag (latest SemVer)]
image:https://img.shields.io/github/go-mod/go-version/foxcapades/tally-go[GitHub go.mod Go version]
image:https://img.shields.io/github/license/foxcapades/tally-go[GitHub]
image:https://img.shields.io/badge/api-docs-ff69b4[title="API Docs", link=https://pkg.go.dev/github.com/foxcapades/tally-go/v0/bytify]
image:https://github.com/Foxcapades/tally-go/workflows/Go/badge.svg[Go]
image:https://codecov.io/gh/Foxcapades/tally-go/branch/main/graph/badge.svg?token=E4WD9IURJL[title=codecov, link=https://codecov.io/gh/Foxcapades/tally-go]

A set of counters for each of the standard Go integer types.

[source,go]
----
package main

import (
  "fmt"
  "github.com/foxcapades/tally-go/v1/tally"
)

func main() {
  // create a new int8 tally wrapping a starting value of 5
  count := tally.ITally8(5)

  fmt.Println(count.Inc())   // 5
  fmt.Println(count.Dec())   // 6
  fmt.Println(count.Add(15)) // 5
  fmt.Println(count.Sub(10)) // 20
  fmt.Println(count.Zero())  // 10
  fmt.Println(count.Cur())   // 0
}
----

Directories

Path Synopsis
v1

Jump to

Keyboard shortcuts

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