ident

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package ident provides the helpers functions.

Index

Constants

This section is empty.

Variables

View Source
var StartNumber = int64(rand.Int32()) << 32

StartNumber is the start number of the ident.

Functions

func GenID

func GenID() string

GenID The function "GenID" generates a new unique identifier and returns it as a string.

func Register added in v0.0.2

func Register(identifier Identifier)

Register sets the defaultIdentifier ident.

func Size added in v0.0.2

func Size() int

Size The function "Size" returns the size of the generated identifier

func Validate

func Validate(id string) bool

Validate The function "Validate" checks whether the given identifier is valid or not.

Types

type Identifier added in v0.0.2

type Identifier interface {
	Name() string
	Gen() string
	Validate(id string) bool
	Size() int
}

Identifier is the interface of ident.

func Default

func Default() Identifier

Default method returns the default defaultGenerator ident.

func NewNumber added in v0.0.2

func NewNumber(sta int64) Identifier

NewNumber method creates a new instance of the ident type.

Directories

Path Synopsis
Package snowflake provides a unique ID generation based on Twitter Snowflake algorithm.
Package snowflake provides a unique ID generation based on Twitter Snowflake algorithm.
Package ulid provides a ULID (Universally Unique Lexicographically Sortable Identifier) implementation.
Package ulid provides a ULID (Universally Unique Lexicographically Sortable Identifier) implementation.
Package uuid provides a UUID (Universally Unique Identifier) implementation.
Package uuid provides a UUID (Universally Unique Identifier) implementation.
Package xid provides a unique identifier generator based on xid.
Package xid provides a unique identifier generator based on xid.

Jump to

Keyboard shortcuts

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