idkit

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package idkit provides the set of functions to generate different kind of identifiers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DigiCode

func DigiCode() string

DigiCode returns 6-digit code as a string.

func ULID

func ULID() string

ULID returns ULID identifier as string. More about ULID: https://github.com/ulid/spec

func ValidateDigiCode

func ValidateDigiCode(code string) error

ValidateDigiCode validates code from DigiCode.

func ValidateULID

func ValidateULID(id string) error

ValidateULID validates string representation of ULID identifier.

func ValidateXID

func ValidateXID(id string) error

ValidateXID validates string representation of XID identifier.

func XID

func XID() string

XID returns short unique identifier as string.

Types

type Error

type Error string

Error represents package level error.

const (
	// ErrInvalidID represents an error which indicates that given TID is invalid.
	ErrInvalidID Error = "id: invalid identifier"
)

func (Error) Error

func (e Error) Error() string

Jump to

Keyboard shortcuts

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