utils

package
v0.1.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DateFormats = []string{"2006-01-02 15:04:05", "2006-01-02 15:04", "2006-01-02"}

Functions

func Bool

func Bool(value any) bool

func Compare

func Compare(value any, other any) int

func DeepCopy

func DeepCopy(m map[string]any) map[string]any

func FileBaseName

func FileBaseName(file string) string

func FileExists

func FileExists(path string) bool

func FileList

func FileList(path string) ([]string, error)

func Merge

func Merge(v0, v1 any) any

func ParseTime

func ParseTime(value string) (time.Time, error)

func RemoveDir

func RemoveDir(path string) error

func Sort

func Sort(key string, f func(string, int, int) int) func(int, int) bool

func SplitPrefix

func SplitPrefix(str string, split string) []string

func SplitTrim

func SplitTrim(str string, split string) []string

func StringConcat

func StringConcat(strs ...string) string

func StringReplace

func StringReplace(s string, vars map[string]string) string

func Truncate

func Truncate(text string, length int, ellipsis string) string

func TruncateHTML

func TruncateHTML(text string, length int, ellipsis string) string

Types

type Cache

type Cache[K comparable, V any] interface {
	Load(K) (V, bool)
	Store(K, V)
	Delete(K)
	Reset()
	Range(func(K, V) bool)
	Len() int
	Iter() iter.Seq2[K, V]
}

func NewCache

func NewCache[K comparable, V any]() Cache[K, V]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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