utils

package
v0.4.4-alpha3 Latest Latest
Warning

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

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

Documentation

Overview

* @Author: LinkLeong a624669980@163.com * @Date: 2022-05-08 14:58:46 * @LastEditors: LinkLeong a624669980@163.com * @LastEditTime: 2022-05-09 13:42:26 * @FilePath: /CasaOS/pkg/utils/network_detection.go * @Description: * * Copyright (c) 2022 by LinkLeong a624669980@163.com, All Rights Reserved.

* @Author: LinkLeong link@icewhale.org * @Date: 2022-08-10 16:06:12 * @LastEditors: LinkLeong * @LastEditTime: 2022-08-10 16:11:37 * @FilePath: /CasaOS/pkg/utils/udev_helper.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodePath added in v0.4.2

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

func Ext added in v0.4.2

func Ext(path string) string

func FixAndCleanPath added in v0.4.2

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 GetActualMountPath added in v0.4.2

func GetActualMountPath(virtualPath string) string

GetActualMountPath remove balance suffix

func GetNetWorkTypeDetection

func GetNetWorkTypeDetection(data chan string, url string)

*

  • @description:
  • @param {chanstring} data
  • @param {string} url
  • @return {*}

func IsBalance added in v0.4.2

func IsBalance(str string) bool

func IsBool added in v0.4.2

func IsBool(bs ...bool) bool

func IsCanceled added in v0.4.2

func IsCanceled(ctx context.Context) bool

func IsSubPath added in v0.4.2

func IsSubPath(path string, subPath string) bool

func JoinBasePath added in v0.4.2

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

func MustParseCNTime added in v0.4.2

func MustParseCNTime(str string) time.Time

func MustSliceConvert added in v0.4.2

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

func NewDebounce added in v0.4.2

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

func NewDebounce2 added in v0.4.2

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

func PathAddSeparatorSuffix added in v0.4.2

func PathAddSeparatorSuffix(path string) string

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

func PathEqual added in v0.4.2

func PathEqual(path1, path2 string) bool

PathEqual judge path is equal

func SliceContains added in v0.4.2

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

SliceContains check if slice contains element

func SliceConvert added in v0.4.2

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 added in v0.4.2

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 * @Date: 2022-06-14 14:33:25 * @LastEditors: LinkLeong * @LastEditTime: 2022-06-14 14:33:49 * @FilePath: /CasaOS/pkg/utils/encryption/md5_helper.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.
* @Author: LinkLeong link@icewhale.com * @Date: 2022-06-14 14:33:25 * @LastEditors: LinkLeong * @LastEditTime: 2022-06-14 14:33:49 * @FilePath: /CasaOS/pkg/utils/encryption/md5_helper.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.
* @Author: LinkLeong link@icewhale.com * @Date: 2022-05-13 18:15:46 * @LastEditors: LinkLeong * @LastEditTime: 2022-07-21 15:27:53 * @FilePath: /CasaOS/pkg/utils/version/version.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.
* @Author: LinkLeong link@icewhale.com * @Date: 2022-05-13 18:15:46 * @LastEditors: LinkLeong * @LastEditTime: 2022-07-21 15:27:53 * @FilePath: /CasaOS/pkg/utils/version/version.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.

Jump to

Keyboard shortcuts

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