Documentation
¶
Index ¶
- func Init(guidBitsSize int)
- func SizeBits() int
- func SizeBytes() int
- type GUID
- func (guid *GUID) AddOffset(offset string)
- func (guid *GUID) Bytes() []byte
- func (guid *GUID) Cmp(guid2 GUID) int
- func (guid *GUID) Copy() *GUID
- func (guid *GUID) Equals(guid2 GUID) bool
- func (guid *GUID) GenerateInnerRandomGUID(topGUID GUID) (*GUID, error)
- func (guid *GUID) Higher(guid2 GUID) bool
- func (guid *GUID) Int64() int64
- func (guid *GUID) Lower(guid2 GUID) bool
- func (guid *GUID) PercentageOffset(offsetPercentage int, nextGuid GUID) string
- func (guid *GUID) Short() string
- func (guid *GUID) String() string
- type Range
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GUID ¶
type GUID struct {
// contains filtered or unexported fields
}
GUID represents a Global Unique Identifier (GUID) for a system's node
func MaximumGUID ¶
func MaximumGUID() *GUID
MaximumGUID creates the maximum available for the current defined number of bits.
func NewGUIDBytes ¶
NewGUIDBytes creates a new GUID based on an array of bytes representation of the identifier. Array of bytes is a representation of the number using the minimum number of bits.
func NewGUIDInteger ¶
NewGUIDInteger creates a new GUID based on an integer64 representation of the identifier.
func NewGUIDRandom ¶
func NewGUIDRandom() *GUID
NewGUIDRandom creates a random GUID in the range [0,MaxGUID).
func NewGUIDString ¶
NewGUIDString creates a new GUID based on a string representation (in base 10) of the identifier.
func (*GUID) Bytes ¶
Bytes returns an array of bytes (with size of guidSizeBits) with the value of the GUID.
func (*GUID) Cmp ¶
Cmp used to check what if the guid is higher, lower or equal than the given guid.
func (*GUID) GenerateInnerRandomGUID ¶
GenerateInnerRandomGUID generates a random GUID that belongs to the interval [this, topGUID).
func (*GUID) Higher ¶
Higher returns true if guid is higher than the given guid and false otherwise.
func (*GUID) PercentageOffset ¶
PercentageOffset returns the number of ids (as a string with an integer in base 10) using % offset to higher GUID.
type Range ¶
type Range struct {
// contains filtered or unexported fields
}
Represents a range of GUIDs i.e. [lowerGUID, higherGUID)
func NewGUIDRange ¶
Creates a new GUID range given a lower GUID and higher GUID.
func (*Range) CreatePartitions ¶
Create partitions (set of ranges) of the receiver range.
func (*Range) GenerateRandomInside ¶
Generate random GUID inside the range.