utils

package
v1.15.3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

New string utilties, will move the rest over time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsStringMap

func AsStringMap(value any) (map[string]any, bool)

AsStringMap attempts to convert any map-like interface to map[string]any.

func Collect

func Collect[T any](value any, mapper func(any) T) []T

Collect transforms a value (single item or slice) into a slice of T using a mapper.

func FirstNonEmpty

func FirstNonEmpty(values ...string) string

FirstNonEmpty returns the first non-empty string in a list of values.

func ToString

func ToString(v any) string

ToString converts any value to a trimmed string.

func UniqueNonEmptyStrings

func UniqueNonEmptyStrings(items []string) []string

UniqueNonEmptyStrings returns unique, non-empty, trimmed strings.

func UserHasRole

func UserHasRole(roles []string, role string) bool

UserHasRole reports whether the user's roles contains the given role.

Types

This section is empty.

Jump to

Keyboard shortcuts

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