syncounter

package
v0.0.0-...-2d29fd2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCounterHasBeenExhausted = errors.New("counter has been exhausted")

Functions

This section is empty.

Types

type Counter

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

func MakeCounter

func MakeCounter(max int64) Counter

MakeCounter create a counter

The upper limit of Counter determined by the max parameter, which is the maximum value of the top line int64 if set to a number less than or equal to 0.

func (*Counter) Count

func (c *Counter) Count(offset int64, condClear delegate.Condition) (start, end int64, err error)

Count Get a set of consecutive positive int64 values and return their start and end values.

When condClear returns true, the counter will be reset.

func (*Counter) CountOne

func (c *Counter) CountOne(condClear delegate.Condition) (val int64, err error)

CountOne return 1 positive int64 value

when the condClear returns true, the counter will be reset.

Jump to

Keyboard shortcuts

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