ids

package module
v0.0.0-...-39a9e80 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 4 Imported by: 9

Documentation

Overview

Package ids encapsulates common id generation uses in namespacelabs projects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeBase32String

func DecodeBase32String(str string) ([]byte, error)

func DecodeBase62String

func DecodeBase62String(str string) ([]byte, error)

func EncodeToBase32String

func EncodeToBase32String(p []byte) string

func EncodeToBase62String

func EncodeToBase62String(p []byte) string

func NewRandomBase32ID

func NewRandomBase32ID(len int) string

NewID returns a random ID in base32, which is not as compact as say base62 but is usable in scenarios which are case agnostic, and only allow alphanumeric values, such as subdomain segments.

func NewRandomBase62ID

func NewRandomBase62ID(len int) string

Returns a base62-encoded ID from an alphanumeric dictionary, best suitable in scenarios which retain case. For IDs that need to managed manually by people, or need to be embedded into domain names or URLs, prefer `NewRandomBase32ID`.

func NewSortableID

func NewSortableID() string

Types

This section is empty.

Jump to

Keyboard shortcuts

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