Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
Container = &UuidContainer{}
)
Initialize a uuid container singleton instance
Functions ¶
func InitializeUuidGenerator ¶
InitializeUuidGenerator initializes the current uuid generator according to the config
Types ¶
type InternalUuidGenerator ¶
type InternalUuidGenerator struct {
// contains filtered or unexported fields
}
InternalUuidGenerator represents internal bundled uuid generator
func NewInternalUuidGenerator ¶
func NewInternalUuidGenerator(config *settings.Config) (*InternalUuidGenerator, error)
NewInternalUuidGenerator returns a new internal uuid generator
func (*InternalUuidGenerator) GenerateUuid ¶
func (u *InternalUuidGenerator) GenerateUuid(idType UuidType) int64
GenerateUuid generates a new uuid
func (*InternalUuidGenerator) GenerateUuids ¶ added in v0.2.0
func (u *InternalUuidGenerator) GenerateUuids(idType UuidType, count uint8) []int64
GenerateUuids generates new uuids
type InternalUuidInfo ¶
type InternalUuidInfo struct { UnixTime uint32 UuidType uint8 UuidServerId uint8 SequentialId uint32 }
InternalUuidInfo represents a struct which has all information in uuid
type UuidContainer ¶
type UuidContainer struct {
Current UuidGenerator
}
UuidContainer contains the current uuid generator
func (*UuidContainer) GenerateUuid ¶
func (u *UuidContainer) GenerateUuid(uuidType UuidType) int64
GenerateUuid returns a new uuid by the current uuid generator
func (*UuidContainer) GenerateUuids ¶ added in v0.2.0
func (u *UuidContainer) GenerateUuids(uuidType UuidType, count uint8) []int64
GenerateUuids returns new uuids by the current uuid generator
type UuidGenerator ¶
type UuidGenerator interface { GenerateUuid(uuidType UuidType) int64 GenerateUuids(uuidType UuidType, count uint8) []int64 }
UuidGenerator is common uuid generator interface
Click to show internal directories.
Click to hide internal directories.