idgen

package
v0.0.0-...-e41513e Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SeqIDGenRegister

func SeqIDGenRegister(name string, adapter SeqIDGenInstance)

func UUIDGenRegister

func UUIDGenRegister(name string, adapter UUIDGenInstance)

Types

type RedisSeqClient

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

func NewRedisSeqClient

func NewRedisSeqClient(redis *redis_client.RedisPool) *RedisSeqClient

func (*RedisSeqClient) GetCurrentSeqID

func (c *RedisSeqClient) GetCurrentSeqID(key string) (seq int64, err error)

func (*RedisSeqClient) GetNextNSeqID

func (c *RedisSeqClient) GetNextNSeqID(key string, n int) (seq int64, err error)

func (*RedisSeqClient) GetNextSeqID

func (c *RedisSeqClient) GetNextSeqID(key string) (seq int64, err error)

func (*RedisSeqClient) Initialize

func (c *RedisSeqClient) Initialize(config string) error

type RpcIDGenClient

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

func (*RpcIDGenClient) GetCurrentSeqID

func (c *RpcIDGenClient) GetCurrentSeqID(key string) (int64, error)

func (*RpcIDGenClient) GetNextNSeqID

func (c *RpcIDGenClient) GetNextNSeqID(key string, n int) (int64, error)

func (*RpcIDGenClient) GetNextSeqID

func (c *RpcIDGenClient) GetNextSeqID(key string) (int64, error)

func (*RpcIDGenClient) GetUUID

func (c *RpcIDGenClient) GetUUID() (int64, error)

func (*RpcIDGenClient) Initialize

func (c *RpcIDGenClient) Initialize(config string) error

type SeqIDGen

type SeqIDGen interface {
	Initialize(config string) error
	GetCurrentSeqID(key string) (int64, error)
	GetNextSeqID(key string) (int64, error)
	GetNextNSeqID(key string, n int) (seq int64, err error)
}

func NewSeqIDGen

func NewSeqIDGen(adapterName, config string) (adapter SeqIDGen, err error)

type SeqIDGenInstance

type SeqIDGenInstance func() SeqIDGen

/////////////////////////////////////////////////////////////////////////////////////////

type SeqsvrClient

type SeqsvrClient struct {
}

func (*SeqsvrClient) GetCurrentSeqID

func (c *SeqsvrClient) GetCurrentSeqID(key string) (int64, error)

func (*SeqsvrClient) GetNextNSeqID

func (c *SeqsvrClient) GetNextNSeqID(key string, n int) (int64, error)

func (*SeqsvrClient) GetNextSeqID

func (c *SeqsvrClient) GetNextSeqID(key string) (int64, error)

func (*SeqsvrClient) Initialize

func (c *SeqsvrClient) Initialize(config string) error

type SnowflakeUUIDGen

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

func NewSnowflakeUUIDGen

func NewSnowflakeUUIDGen(serverId int) *SnowflakeUUIDGen

func (*SnowflakeUUIDGen) GetUUID

func (id *SnowflakeUUIDGen) GetUUID() (int64, error)

func (*SnowflakeUUIDGen) Initialize

func (id *SnowflakeUUIDGen) Initialize(config string) error

type UUIDGen

type UUIDGen interface {
	Initialize(config string) error
	GetUUID() (int64, error)
}

/////////////////////////////////////////////////////////////////////////////////////////

func NewUUIDGen

func NewUUIDGen(adapterName, config string) (adapter UUIDGen, err error)

type UUIDGenInstance

type UUIDGenInstance func() UUIDGen

Jump to

Keyboard shortcuts

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