util

package
v0.0.0-...-6bb069b Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Lang = ""

全局变量

Functions

func ClearFolder

func ClearFolder(path string)

func ContainsKey

func ContainsKey(src map[string]interface{}, key string) bool

func ConvertToHump

func ConvertToHump(src string) string

func CopyFile

func CopyFile(sourcePath string, newPath string) bool

func DefaultEmptyArray

func DefaultEmptyArray(kvs map[string]interface{}, key string) interface{}

func DefaultValue

func DefaultValue(kvs map[string]interface{}, key string) interface{}

func DeleteFile

func DeleteFile(path string) bool

func EndWith

func EndWith(src string, dst string) bool

func ErrorWrapper

func ErrorWrapper(error interface{}) *stackError.Error

func Escaped

func Escaped(x string) interface{}

func ExecuteCommand

func ExecuteCommand(command string, params ...string) (string, error)

*

  • eg: ExecuteCommand("ls", "-a", "-l")

func ExecuteFullCommand

func ExecuteFullCommand(fullCommand string) (string, error)

* eg: ExecuteCommand("ls -a -l") * you shouldn't use this function while any param of the command has blank. * eg: ExecuteCommand("echo 'abc def'")

func GetOrDefault

func GetOrDefault(kvs map[string]string, key string, defaultV string) string

* map扩展

func GitDownload

func GitDownload(remoteUrl string, username string, password string, checkoutAs string, project string) *errors.Error

* git工具

func Insert

func Insert(slice []interface{}, index int, value interface{}) []interface{}

* 插入到切片

func IsArray

func IsArray(param interface{}) bool

* 判断是否为array

func IsDirExists

func IsDirExists(dir string) bool

func IsEmpty

func IsEmpty(src string) bool

* string扩展

func IsFileExists

func IsFileExists(file string) bool

func IsMap

func IsMap(param interface{}) bool

func IsString

func IsString(src interface{}) bool

func LoadConfig

func LoadConfig(configPath string) map[string]string

* 加载配置

func LogInit

func LogInit(logPath string)

* 初始化log

func NewFile

func NewFile(baseDir string, name string, isFolder bool) bool

* file工具

func PackageSystemEnvIntoParam

func PackageSystemEnvIntoParam(params map[string]interface{})

* 系统变量,插件可能会用到

func PrintErrorStack

func PrintErrorStack(error interface{})

* 打印日志

func StackString

func StackString(error interface{}) string

func StartWith

func StartWith(src string, dst string) bool

func SvnDownload

func SvnDownload(remoteUrl string, username string, password string, checkoutAs string, project string) *errors.Error

* svn工具

func Transform

func Transform(src map[string][]string) map[string]interface{}

func Unescaped

func Unescaped(x string) interface{}

Types

type ConcurrentMap

type ConcurrentMap struct {
	// contains filtered or unexported fields
}

* 并发map

func MakeConcurrentMap

func MakeConcurrentMap() *ConcurrentMap

func (*ConcurrentMap) ContainsKey

func (m *ConcurrentMap) ContainsKey(key string) bool

func (*ConcurrentMap) Get

func (m *ConcurrentMap) Get(key string) interface{}

func (*ConcurrentMap) Iterator

func (m *ConcurrentMap) Iterator() <-chan Entry

func (*ConcurrentMap) Put

func (m *ConcurrentMap) Put(key string, value interface{})

func (*ConcurrentMap) Remove

func (m *ConcurrentMap) Remove(key string)

func (*ConcurrentMap) ToPrettyString

func (m *ConcurrentMap) ToPrettyString() string

func (*ConcurrentMap) ToString

func (m *ConcurrentMap) ToString() string

type Entry

type Entry struct {
	Key   string
	Value interface{}
}

Jump to

Keyboard shortcuts

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