tools

package
v0.0.0-...-48ca4bb Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDir

func CreateDir(path string) error

CreateDir 文件夹创建

func ExistsDirectory

func ExistsDirectory(path string) bool

ExistsDirectory 文件夹是否存在

参数:
path	string	检测的目录地址
return	bool	目录是否存在

func ExistsFile

func ExistsFile(path string) bool

ExistsFile 文件是否存在

参数:
path	string	检测的文件地址

func GetCurrentPath

func GetCurrentPath() (string, error)

GetCurrentPath 获取当前程序运行路径

return	string,error 当前运行路径,err
例如: E:/Go/ProjectTest/ <nil>

func GetCurrentPathNoError

func GetCurrentPathNoError() string

GetCurrentPathNoError 获取当前程序运行路径

return	string	当前运行路径,如果获取失败返回""
例如: E:/Go/ProjectTest/ <nil>

func IntSliceRemoveReplica

func IntSliceRemoveReplica(slc []int) []int

func MapContainsKey

func MapContainsKey(imap map[string]string, key string) bool

func MapContainsValue

func MapContainsValue(imap map[string]string, value string) bool

func MapGetFirstKeyByValue

func MapGetFirstKeyByValue(imap map[string]string, value string) string

func MapVArrayContainsKey

func MapVArrayContainsKey(imap map[string][]string, key string) bool

func SaveBinary

func SaveBinary(filePath string, data []byte) error

func SliceContainKey

func SliceContainKey(slice []string, key string) bool

map或者slice中是否存在指定Key

func SliceContains

func SliceContains(slice []string, key string) bool
			s := reflect.ValueOf(slice)
			fmt.Println(s)
			for i := 0; i < s.Len(); i = i + 2 {
				if reflect.DeepEqual(key, s.Index(i).Interface()) {
					fmt.Println("True")
					return true
				}
			}
			return false
		}
	case reflect.Map:
		{
			if reflect.ValueOf(slice).MapIndex(reflect.ValueOf(key)).IsValid() {
				return true
			}
			return false
		}
	}
	return false
}

func StringSliceRemoveReplica

func StringSliceRemoveReplica(slc []string) []string

Types

type UUID

type UUID [16]byte

func FromTime

func FromTime(aTime time.Time) UUID

func TimeUUID

func TimeUUID() UUID

func (UUID) String

func (u UUID) String() string

len()=36 中间使用-分割

func (UUID) ToString

func (u UUID) ToString() string

小写 len()=32

func (UUID) ToStringCapital

func (u UUID) ToStringCapital() string

大写 len()=32

Jump to

Keyboard shortcuts

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