https://github.com/foxcapades/tally-go
https://github.com/foxcapades/tally-go
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/foxcapades/tally-go
- Owner: Foxcapades
- License: mit
- Created: 2020-11-27T08:24:57.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-11-29T14:53:30.000Z (over 5 years ago)
- Last Synced: 2025-02-12T17:19:21.886Z (over 1 year ago)
- Language: Go
- Size: 11.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.adoc
- License: LICENSE
Awesome Lists containing this project
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/v1/tally]
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
}
----