pregen

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: MIT Imports: 5 Imported by: 0

README

Prefixed ID Generator

Basing this distributed ID generator off of MongoDB's ObjectId

The ObjectId consists of the following:

  • A timestamp measured in seconds - 4 bytes

  • A random value generated from a cryptographically random number generator. The value is unique to the machine - 5 bytes

  • An incrementing counter. Initialized to a random value - 2 bytes

Those elements will combine to generate a 11-byte unique ID from which a prefix can be added e.g.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildId

func BuildId(prefix string) ([]byte, string, int64, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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