Categorygithub.com/cognusion/go-sequence
repositorypackage
1.1.0
Repository: https://github.com/cognusion/go-sequence.git
Documentation: pkg.go.dev

# README

sequence

import "github.com/cognusion/go-sequence"

Overview

Package sequence provides a performant goro-safe incrementing sequencer, with randomized HashID-encoding of the values to work as a font of IDs for errors, requests, etc.

Index

Package files

seq.go

type Seq

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

Seq is a sequencer. It should never be used by default, and instead obtained via a New function

func New

func New(start int) *Seq

New returns an initialized Seq suitable for most cases

func NewWithHashIDLength

func NewWithHashIDLength(start, hashIDlength int) *Seq

NewWithHashIDLength returns an initilized Seq with the minimum hashID length set as specified

func (*Seq) Next

func (s *Seq) Next() int

Next returns the next int in the sequence

func (*Seq) NextHashID

func (s *Seq) NextHashID() string

NextHashID returns the hashID-encoded value of the next int in the sequence


Generated by godoc2md