sequence

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: Apache-2.0, MIT Imports: 8 Imported by: 0

README

Sequence

A common interface to generate a sequence.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base62

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

func NewBase62

func NewBase62(inner Sequence[uint64]) *Base62

func (*Base62) Next

func (s *Base62) Next(ctx context.Context) (string, error)

type Redis

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

func NewRedis

func NewRedis(c *redis.Client, key string) *Redis

func (*Redis) Next

func (s *Redis) Next(ctx context.Context) (uint64, error)

type Sequence

type Sequence[T any] interface {
	Next(ctx context.Context) (T, error)
}

type Sonyflake

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

func NewSonyflake

func NewSonyflake(machineid uint16) *Sonyflake

func (*Sonyflake) Next

func (g *Sonyflake) Next(ctx context.Context) (uint64, error)

type SonyflakeGroup

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

func NewSonyflakeGroup

func NewSonyflakeGroup(start uint16, size int) *SonyflakeGroup

func (*SonyflakeGroup) Next

func (g *SonyflakeGroup) Next(ctx context.Context) (uint64, error)

type UUID

type UUID struct {
}

func (*UUID) Next

func (g *UUID) Next(ctx context.Context) (string, error)

Jump to

Keyboard shortcuts

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