naco-api/internal/utils/counter.go
Nacorid 52ac01ecaa
All checks were successful
CI/CD Go Verification / build_and_test (push) Successful in 1m44s
fix: long standing typo
2026-08-03 13:23:52 +00:00

23 lines
290 B
Go

package utils
import "sync/atomic"
type Counter struct {
value atomic.Int64
}
func NewCounter() *Counter {
return &Counter{}
}
func (c *Counter) Increment() {
c.value.Add(1)
}
func (c *Counter) Get() int64 {
return c.value.Load()
}
func (c *Counter) Reset() {
c.value.Store(0)
}