ulidutil

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: LGPL-2.1 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewString

func NewString() string

NewString returns an ULID as a string, with the current time. It is safe for concurrent use

func NewStringWithTime

func NewStringWithTime(t time.Time) string

NewStringWithTime returns an ULID as a string, with the given time. Panic on failure.

func SecureEntropy

func SecureEntropy() io.Reader

SecureEntropy returns a thread-safe per process monotonically increasing secure entropy source

Types

type Service

type Service interface {
	// NewString returns an ULID as a string, with the current time. Panic on failure.
	NewString() string
	// NewStringWithTime returns an ULID as a string, with the given time. Panic on failure.
	NewStringWithTime(t time.Time) string
	// New returns an ULID with the current time
	New() (ULID, error)
	// MustNew returns an ULID with the current time. Panic on failure.
	MustNew() ULID
	// NewWithTime returns an ULID with given time
	NewWithTime(t time.Time) (ULID, error)
	// MustNewWithTime returns an ULID with given time. Panic on failure.
	MustNewWithTime(t time.Time) ULID
}

Service represents the interface for the ULID utils

func NewService

func NewService() Service

NewService returns ULID service with some handy functions

type ULID

type ULID = ulid.ULID

An ULID is a 16 byte Universally Unique Lexicographically Sortable Identifier

Jump to

Keyboard shortcuts

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