utils

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KC_RAND_KIND_NUM   = 0
	KC_RAND_KIND_LOWER = 1
	KC_RAND_KIND_UPPER = 2
	KC_RAND_KIND_ALL   = 3
)
View Source
const (
	VersionMinLen = 0
	VersionMaxLen = 63
)
View Source
const (
	AES_KEY = "12345678abcdefgh"
	AES_IV  = "abcdefgh12345678"
)

crypto && decrypt

Variables

This section is empty.

Functions

func AesEny added in v1.3.2

func AesEny(plaintext []byte) []byte

CTR 128bit no padding

func AppPath

func AppPath() string

AppPath returns the absolute path of the application's binary.

func Contains

func Contains(s []string, e string) bool

Contains ..

func EnsureAbs

func EnsureAbs(path string) string

EnsureAbs prepends the WorkDir to the given path if it is not an absolute path.

func GenerateRandomstring added in v1.5.0

func GenerateRandomstring(length int) string

func GetRootPath

func GetRootPath(path string) string

func IntContains

func IntContains(s []int64, e int64) bool

IntContains ..

func IsIllegalLength

func IsIllegalLength(s string, min int, max int) bool

验证字符长度

func Krand

func Krand(size int, kind int) []byte

func MakeToken

func MakeToken() string

func NewUUID

func NewUUID() string

func PathsIsEqual

func PathsIsEqual(path1, path2 string) bool

func Restricted

func Restricted(s, regdata string) bool

正则表达式验证字符合法性

func WorkDir

func WorkDir() string

WorkDir returns the absolute path of work directory. It reads the value of envrionment variable GOGS_WORK_DIR. When not set, it uses the directory where the application's binary is located.

Types

type SyncLocker

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

func NewSyncLocker

func NewSyncLocker() *SyncLocker

func (*SyncLocker) Lock

func (l *SyncLocker) Lock(key string)

func (*SyncLocker) Unlock

func (l *SyncLocker) Unlock(key string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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