util

package
v0.0.0-...-14e102d Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanPath

func CleanPath(path string) string

func Copy

func Copy(ctx context.Context, dst io.Writer, src io.Reader, progress func(int64)) (int64, error)

func CopyN

func CopyN(ctx context.Context, dst io.Writer, src io.Reader, n int64, progress func(int64)) (int64, error)

func CopyNWithContext

func CopyNWithContext(ctx context.Context, dst io.Writer, src io.Reader, n int64) (int64, error)

func CopyWithContext

func CopyWithContext(ctx context.Context, dst io.Writer, src io.Reader) (int64, error)

func IsSubPath

func IsSubPath(path string, subPath string) bool

func Pipe

func Pipe() (*reader, *writer)

func PrettyByteSize

func PrettyByteSize(b int) string

func Ptr

func Ptr[T any](x T) *T

func StrReplace

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

func VerifyOption

func VerifyOption(value interface{}) error

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]

type DynamicModel

type DynamicModel[T any] struct {
	// contains filtered or unexported fields
}

func NewDynamicModel

func NewDynamicModel[T any](oldModel T, tagName string, replacer map[string]string) *DynamicModel[T]

func (*DynamicModel[T]) Model

func (m *DynamicModel[T]) Model() T

func (*DynamicModel[T]) NewModel

func (m *DynamicModel[T]) NewModel() any

type Filter

type Filter struct {
	*viper.Viper
}

func NewFilter

func NewFilter(m map[string]string) *Filter

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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