utils

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package utils provides utility functions and types used across the Omnom application.

This package contains helper functions for common operations including:

  • String-based error types for constant errors
  • Key-value data structure construction from variadic arguments
  • File extension extraction from URLs and paths

These utilities are used throughout the codebase to reduce code duplication and provide consistent behavior for common operations.

Example usage:

// Create a string error
const ErrNotFound = utils.StringError("not found")

// Build a map from key-value pairs
data, err := utils.KVData("name", "John", "age", 30)

// Extract file extension
ext := utils.GetExtension("https://example.com/image.jpg")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetExtension added in v0.8.0

func GetExtension(s string) string

GetExtension extracts the file extension from a URL or path.

func KVData

func KVData(values ...any) (map[string]any, error)

KVData creates a map from alternating key-value arguments.

Types

type StringError

type StringError string

StringError is a string that implements the error interface.

func (StringError) Error

func (e StringError) Error() string

Jump to

Keyboard shortcuts

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