utils

package
v1.21.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RuneKindNum   = "num"
	RuneKindLower = "lower"
	RuneKindUpper = "upper"
	RuneKindChar  = "char"
)
View Source
const (
	BYTE = 1 << (10 * iota)
	KILOBYTE
	MEGABYTE
	GIGABYTE
	TERABYTE
	PETABYTE
	EXABYTE
)

Variables

This section is empty.

Functions

func BoolToFloat64

func BoolToFloat64(a bool) float64

func BoolToString

func BoolToString(a bool) string

func ConvertBytes

func ConvertBytes(bytes float64) string

ConvertBytes 保留两位小数

func CopyFileByLine

func CopyFileByLine(dest, src string) (lineCount int64, err error)

func DayStartTime

func DayStartTime(t time.Time) time.Time

DayStartTime 返回当天0点

func EnsurePathExists

func EnsurePathExists(dirname string) error

func FormatMysqlDumpTime

func FormatMysqlDumpTime(t *time.Time) string

func GeneratePassword

func GeneratePassword() string

func JoinFlagName

func JoinFlagName(prefix, key string) string

func MakePassword

func MakePassword(input string) (string, error)

func NextDayStartTime

func NextDayStartTime(t time.Time) time.Time

func RandomRune

func RandomRune(n int, kind string) []rune

func RoundTo

func RoundTo(n float64, decimals uint32) float64

保留n位小数

func StrOrDef

func StrOrDef(s string, def string) string

func TimeZeroToNull

func TimeZeroToNull(t *time.Time) *time.Time

func ToUint

func ToUint(id string) uint

func UintToStr

func UintToStr(i *uint) string

func ValidPassword

func ValidPassword(input string) error

func ValidatePassword

func ValidatePassword(password string, hashedPassword string) error

Types

type DesEncryptor

type DesEncryptor struct {
	Key []byte
}

func (*DesEncryptor) DecryptBase64

func (e *DesEncryptor) DecryptBase64(input string) (string, error)

func (*DesEncryptor) EncryptBase64

func (e *DesEncryptor) EncryptBase64(input string) (string, error)

func (*DesEncryptor) Padding

func (e *DesEncryptor) Padding(cipherText []byte, blockSize int) []byte

func (*DesEncryptor) UnPadding

func (e *DesEncryptor) UnPadding(data []byte) []byte

Directories

Path Synopsis
* OCI Distribution Specification Client * * For more information visit below URL * https://github.com/opencontainers/distribution-spec/blob/main/spec.md#endpoints *
* OCI Distribution Specification Client * * For more information visit below URL * https://github.com/opencontainers/distribution-spec/blob/main/spec.md#endpoints *

Jump to

Keyboard shortcuts

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