utils

package
v0.4.8-alpha4 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodePath

func EncodePath(path string, all ...bool) string

func Ext

func Ext(path string) string

func FixAndCleanPath

func FixAndCleanPath(path string) string

FixAndCleanPath The upper layer of the root directory is still the root directory. So ".." And "." will be cleared for example 1. ".." or "." => "/" 2. "../..." or "./..." => "/..." 3. "../.x." or "./.x." => "/.x." 4. "x//\\y" = > "/z/x"

func IsBool

func IsBool(bs ...bool) bool

func IsCanceled

func IsCanceled(ctx context.Context) bool

func IsSubPath

func IsSubPath(path string, subPath string) bool

func JoinBasePath

func JoinBasePath(basePath, reqPath string) (string, error)

func MustParseCNTime

func MustParseCNTime(str string) time.Time

func MustSliceConvert

func MustSliceConvert[S any, D any](srcS []S, convert func(src S) D) []D

func NewDebounce

func NewDebounce(interval time.Duration) func(f func())

func NewDebounce2

func NewDebounce2(interval time.Duration, f func()) func()

func PathAddSeparatorSuffix

func PathAddSeparatorSuffix(path string) string

PathAddSeparatorSuffix Add path '/' suffix for example /root => /root/

func PathEqual

func PathEqual(path1, path2 string) bool

PathEqual judge path is equal

func SliceContains

func SliceContains[T comparable](arr []T, v T) bool

SliceContains check if slice contains element

func SliceConvert

func SliceConvert[S any, D any](srcS []S, convert func(src S) (D, error)) ([]D, error)

SliceConvert convert slice to another type slice

func SliceEqual

func SliceEqual[T comparable](a, b []T) bool

SliceEqual check if two slices are equal

Types

This section is empty.

Directories

Path Synopsis
@Author: LinkLeong link@icewhale.com
@Author: LinkLeong link@icewhale.com

Jump to

Keyboard shortcuts

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