utils

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ULIDLength is the standard length of a ULID
	ULIDLength = 26

	// ValidULIDChars contains all valid characters for a ULID (Crockford's base32)
	// Excludes I, L, O, U to avoid confusion
	ValidULIDChars = "0123456789ABCDEFGHJKMNPQRSTVWXYZabcdefghjkmnpqrstvwxyz"
)

Variables

This section is empty.

Functions

func ExtractULIDFromIdentifier

func ExtractULIDFromIdentifier(identifier string) string

ExtractULIDFromIdentifier extracts a ULID from a string that may contain other text For example: "My Org (01HKT3M4Y8Z5V6R9S7X2F0Q3WE)" returns "01HKT3M4Y8Z5V6R9S7X2F0Q3WE"

func GenerateULID

func GenerateULID() string

GenerateULID generates a new ULID

func GetULIDFromOrg

func GetULIDFromOrg(org *dotenv.Organization) string

GetULIDFromOrg extracts the ULID from an organization, checking both ULID and ID fields This handles the API inconsistency where ULID is sometimes returned in the ID field

func IsValidULID

func IsValidULID(s string) bool

IsValidULID checks if a string is a valid ULID format

func NormalizeULID

func NormalizeULID(ulid string) string

NormalizeULID converts a ULID to uppercase for consistent comparison

func Slugify

func Slugify(input string) string

Slugify converts a string into a URL-friendly slug Rules: - Convert to lowercase - Replace spaces with hyphens - Remove special characters except: a-z, 0-9, -, _, . - Collapse multiple hyphens - Trim hyphens from start/end

func ValidateULID

func ValidateULID(ulid string) error

ValidateULID validates a ULID and returns an error if invalid

Types

This section is empty.

Jump to

Keyboard shortcuts

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