sequence

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSequence

func NewSequence(generator *config.SequenceGenerator, tableName string) (proto.SequenceGenerator, error)

Types

type SegmentConfig

type SegmentConfig struct {
	DSN  string `yaml:"dsn" json:"dsn"`
	From int64  `yaml:"from" json:"from"`
	Step int64  `default:"1000" yaml:"step" json:"step"`
}

type SegmentWorker

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

func NewSegmentWorker

func NewSegmentWorker(dsn string, from, len int64, biz string) (*SegmentWorker, error)

func (*SegmentWorker) NextID

func (w *SegmentWorker) NextID() (int64, error)

func (*SegmentWorker) ProduceID

func (w *SegmentWorker) ProduceID()

type SnowflakeConfig

type SnowflakeConfig struct {
	WorkerID int64 `json:"worker_id"`
}

type SnowflakeWorker

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

func NewWorker

func NewWorker(id int64) (*SnowflakeWorker, error)

func (*SnowflakeWorker) NextID

func (w *SnowflakeWorker) NextID() (int64, error)

Jump to

Keyboard shortcuts

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