jutils

package module
v0.0.0-...-c1222d2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: MIT Imports: 21 Imported by: 7

Documentation

Overview

*************************************************************************** MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************

*************************************************************************** MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************

*************************************************************************** MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of t he Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************

*************************************************************************** MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************

Index

Constants

This section is empty.

Variables

View Source
var IsInitRandSeed bool = false

Functions

func AesBase64Decode

func AesBase64Decode(data string, keystr string) (string, error)

AES解密

func AesBase64Encode

func AesBase64Encode(origstr string, keystr string) (string, error)

AES加密,CBC

func AppendToFile

func AppendToFile(file, err string)

AppendToFile

func CalcFileMD5

func CalcFileMD5(path string) (string, error)

func CalcFileMd5

func CalcFileMd5(path string) (string, error)

func Copy

func Copy(a interface{}, b interface{}, skip []string) error

copy filed a-->b skip will ignore some filed

func CopyFiled

func CopyFiled(a interface{}, b interface{}, skip []string) error

copy filed a-->b filed ignore filed

func FileIsExists

func FileIsExists(filepath string) bool

* * add by yjh 211124 * check fiel esists

func Find

func Find(list []string, a string) bool

find a in list

func FromBase64

func FromBase64(data string) (string, error)

func InAInB

func InAInB(a []string, b []string) []string

In A and B

func InAnotB

func InAnotB(a []string, b []string) []string

In A not In B

func InitRandSeed

func InitRandSeed()

func MD5

func MD5(content string) string

func MakeAbsPath

func MakeAbsPath(path string, dir string)

make dir

func Md5

func Md5(content string) string

func MkDir

func MkDir(path string)

add by yjh 211124 make dir

func NewGUID

func NewGUID() string

make guid and ToUpper add by yjh 211126

func NewGuid

func NewGuid() string

make guid add by yjh 211126

func NewRandMN

func NewRandMN(min int, max int) func() int

func NewRandMN32

func NewRandMN32(min int32, max int32) func() int32

func NewRandMN64

func NewRandMN64(min int64, max int64) func() int64

func NewRandN

func NewRandN(max int) func() int

func NewRandN32

func NewRandN32(max int32) func() int32

func NewRandN64

func NewRandN64(max int64) func() int64

func ParseFileName

func ParseFileName(bfile string) (string, string)

ParseFileName

func ReadFileAll

func ReadFileAll(path string) (string, error)

* * add by yjh 211124 * read file content

func ReadFileLine

func ReadFileLine(path string, fc func([]byte) bool) error

read line

func ReverseString

func ReverseString(s string) string

func Run

func Run(c string, p string) error

func RunCmd

func RunCmd(c string, p string) (error, string)

func RunCmdWithErrEx

func RunCmdWithErrEx(c string, p ...string) (error, string)

func RunCommand

func RunCommand(path string, args string) error

func RunCommandResult

func RunCommandResult(path string, args string) string

func RunCommandWithErr

func RunCommandWithErr(dir string, cmd string) (string, error)

func RunCommandWithParam

func RunCommandWithParam(path string, cmd string, args ...string) error

func RunCommandWithParamAndResult

func RunCommandWithParamAndResult(path string, cmd string, args ...string) string

func RunEx

func RunEx(c string, p ...string) error

func RunLinuxCmd

func RunLinuxCmd(c string, p string) (error, string)

func SHA1

func SHA1(data string) string

func Sha1

func Sha1(data string) string

func ToBase64

func ToBase64(data string) string

func WriteToFile

func WriteToFile(file, err string)

WriteToFile

Types

type Encoding

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

func NewEncoding

func NewEncoding() *Encoding

func (*Encoding) FromBase62

func (en *Encoding) FromBase62(indata string) int64

func (*Encoding) ToBase62

func (en *Encoding) ToBase62(indata int64) string

type IFileWriter

type IFileWriter interface {
	Line(string) IFileWriter
	Lines([]string) IFileWriter
	Close() error
}

a link writer for writing file

func NewFile

func NewFile(file string) IFileWriter

type IntKeyUtils

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

func BuildIntKey

func BuildIntKey(keys []int) *IntKeyUtils

func (*IntKeyUtils) Find

func (r *IntKeyUtils) Find(key int) bool

type RandStrUtil

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

func BuildRandStr

func BuildRandStr(str string) *RandStrUtil

func (*RandStrUtil) Rand

func (r *RandStrUtil) Rand(count int) string

make rand str in strmap add by yjh 211110

type StringKeyUtils

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

func BuildStringKey

func BuildStringKey(keys []string) *StringKeyUtils

func (*StringKeyUtils) Find

func (r *StringKeyUtils) Find(key string) bool

Jump to

Keyboard shortcuts

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