util

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package util provides shared utility functions for the llm-router framework.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateID

func GenerateID() (string, error)

GenerateID returns a cryptographically secure 16-byte hex string (32 characters). Used for database record IDs across all services.

func GenerateToken

func GenerateToken() (string, error)

GenerateToken returns a cryptographically secure 32-byte hex string (64 characters). Used for session tokens and router tokens that require higher entropy.

func HashSecret

func HashSecret(secret string) string

HashSecret produces a deterministic SHA-256 hex digest of a secret string. Used for storing hashed tokens in the database.

func Now

func Now() time.Time

Now returns the current time in UTC. Centralizes timestamp generation for consistency across the application.

func NowPtr

func NowPtr() *time.Time

NowPtr returns a pointer to the current UTC time. Useful for optional timestamp fields.

func Slugify added in v0.1.2

func Slugify(name string) string

Slugify converts a name to a URL-safe slug, or "" when unusable. Single source of truth for slugs across providers, virtual models and plugin repositories; callers apply their own empty fallback.

func SlugifyOrDefault added in v0.4.0

func SlugifyOrDefault(name, fallback string) string

SlugifyOrDefault slugifies a name, returning the fallback when unusable. Providers use it with the "provider" fallback so generated identifiers never read empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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