stream

package
v0.0.58 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 37 Imported by: 14

Documentation

Index

Constants

View Source
const TimeLayout = "2006-01-02 15:04:05"

Variables

View Source
var (
	RegexpIp     = regexp.MustCompile(`((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))`)
	RegexpIpPort = regexp.MustCompile(`((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d))):([0-9]+)`)
)
View Source
var DefaultFileServerPort = ":8080"
View Source
var RegexpCenter = `(.+?)`

Functions

func AlignString

func AlignString(s string, length int) (ss string)

func Atoi

func Atoi(s string) int

func BaseName

func BaseName(path string) string

func Concat

func Concat[S ~[]E, E any](slices_ ...S) S

func ConvertUtf82Gbk

func ConvertUtf82Gbk(src string) (ss string)

func CopyDir

func CopyDir(dst, src string) error

func CopyFile added in v0.0.50

func CopyFile(path, dstPath string)

func CreatDirectory

func CreatDirectory(dir string) bool

func CurrentDirName

func CurrentDirName(path string) (currentDirName string)

func CutUint16

func CutUint16(u uint16) uint8

func CutUint16_

func CutUint16_(u uint16) uint8

func DirDepth added in v0.0.6

func DirDepth(dirPath string) (depth int)

func FileServer added in v0.0.17

func FileServer()

func FileServerFS added in v0.0.17

func FileServerFS(fs embed.FS)

func FixFilePath added in v0.0.58

func FixFilePath(path string) string

func Float64Cut

func Float64Cut(value float64, bits int) (float64, error)

func Float64ToString

func Float64ToString(f float64, prec int) string

func FormatDuration

func FormatDuration(d time.Duration) string

func FormatTime

func FormatTime(t time.Time) string

func Gbk2Utf8

func Gbk2Utf8(gbk string) (utf8 string)

func GenA2Z added in v0.0.17

func GenA2Z() (letters []string)

func GetDiffDays

func GetDiffDays(dstTime string) string

func GetLocalIPs added in v0.0.17

func GetLocalIPs() []net.IP

func GetPackageName

func GetPackageName() (pkgName string)

func GetTimeNowString

func GetTimeNowString() string

func GetTimeStamp

func GetTimeStamp() string

func GetTimeStamp13Bits

func GetTimeStamp13Bits() int64

func GetUserConfigDirs

func GetUserConfigDirs() (UserConfigDirs map[string]string)

func GetWindowsLogicalDrives added in v0.0.17

func GetWindowsLogicalDrives() []string

func GitProxy

func GitProxy(isSetProxy bool)

func GoReleaser added in v0.0.9

func GoReleaser()

func HomeDir

func HomeDir() string

func IntegerToIP

func IntegerToIP(ip int64) string

func IsAix

func IsAix() bool

func IsAndroid

func IsAndroid() bool

func IsDarwin

func IsDarwin() bool

func IsDir

func IsDir(path string) bool

func IsDirEx added in v0.0.50

func IsDirEx(path string) (ok bool)

func IsDirRoot added in v0.0.6

func IsDirRoot(path string) bool

func IsDragonfly

func IsDragonfly() bool

func IsFilePath

func IsFilePath(path string) bool

func IsFilePathEx added in v0.0.23

func IsFilePathEx(path string) (ok bool)

func IsFreebsd

func IsFreebsd() bool

func IsHurd

func IsHurd() bool

func IsIllumos

func IsIllumos() bool

func IsIos

func IsIos() bool

func IsJs

func IsJs() bool

func IsLinux

func IsLinux() bool

func IsNacl

func IsNacl() bool

func IsNetbsd

func IsNetbsd() bool

func IsOpenbsd

func IsOpenbsd() bool

func IsPlan9

func IsPlan9() bool

func IsSolaris

func IsSolaris() bool

func IsTermux

func IsTermux() bool

func IsWasip1

func IsWasip1() bool

func IsWindows

func IsWindows() bool

func IsZero

func IsZero(v reflect.Value) bool

func IsZos

func IsZos() bool

func JoinHomeDir

func JoinHomeDir(path string) (join string)

func JoinHomeFile

func JoinHomeFile(path string) (join string)

func JsonIndent

func JsonIndent(b []byte) string

func Lines

func Lines(x []byte) []string

func MakeCommandArg added in v0.0.16

func MakeCommandArg(arg ...string) string

func MarshalJSON

func MarshalJSON(v any) []byte

func MarshalJsonToFile

func MarshalJsonToFile(v any, name string)

func MoveFile

func MoveFile(src, dst string)

func NewVersion

func NewVersion[T string | uint64](s ...T) (v *object)

func ParseFloat

func ParseFloat(sizeStr string) (size float64)

func ParseInt

func ParseInt(s string) int64

func ParseUint

func ParseUint(s string) uint64

func RandomAny added in v0.0.13

func RandomAny[T any](slice []T) T

func ReadEmbedFileMap added in v0.0.11

func ReadEmbedFileMap(embedFiles embed.FS, dir string) *maps.SafeMap[string, []byte]

func ReadFileToLines

func ReadFileToLines(path string) (lines []string)

func ReadLines

func ReadLines(fullPath string) ([]string, error)

func ReflectVisibleFields added in v0.0.14

func ReflectVisibleFields(object any) []reflect.StructField

func RegexpWebBodyBlocks

func RegexpWebBodyBlocks(tagName string) string

func RunDir

func RunDir() string

func SerialNumber

func SerialNumber(b string) string

func SetNameAndEmail

func SetNameAndEmail(s *Buffer)

func SetProxy

func SetProxy(s *Buffer, isSetProxy bool)

func SetSafecrlf

func SetSafecrlf(s *Buffer)

func SlicesIndex

func SlicesIndex(slice any, item any) int

func SlicesInsert

func SlicesInsert(slice any, index int, value any) any

func SplitFileByLines

func SplitFileByLines(filePath string, size int)

func SubStrRunes

func SubStrRunes(s string, length int) string

func SwapBytes

func SwapBytes(src []byte) (dst []byte)

func SwapBytes2HexString2

func SwapBytes2HexString2(src HexString) (dst string)

func ToCamel

func ToCamel(data string, isCommit bool) string

func ToCamelToLower

func ToCamelToLower(s string, isCommit bool) string

func ToCamelUpper

func ToCamelUpper(s string, isCommit bool) string

func ToLines

func ToLines[T string | []byte | *os.File | *bytes.Buffer](data T) (lines []string)

func TrimExtension

func TrimExtension(path string) string

func TrimSlash added in v0.0.56

func TrimSlash(name string) string

func UnFormatDuration

func UnFormatDuration(s string) time.Duration

func UnFormatTime

func UnFormatTime(s string) time.Time

func Unquote

func Unquote(line string) string

func UpdateModsByWorkSpace

func UpdateModsByWorkSpace(isTidy, isUpdateAll bool, modWithCommitID ...string)

func Utf82Gbk

func Utf82Gbk(utf8 string) (gbk string)

func WriteAppend

func WriteAppend[T Type](name string, data T)

func WriteBinaryFile

func WriteBinaryFile[T Type](name string, data T)

func WriteGoFile

func WriteGoFile[T Type](name string, data T)

func WriteLines

func WriteLines(lines []string, fullPath string) error

func WriteTruncate

func WriteTruncate[T Type](name string, data T)

Types

type AppKind

type AppKind byte
const (
	SuperRecovery4Kind AppKind = iota
	AneData6Kind
	ChaoQiangZhaoPianKind
	DataExploreKind
	DiskGetorKind
	DocxBuildKind
	ExcelHuiFuZhuanJiaKind
	ExcelRebuild1Kind
	ExcelRebuild3Kind
	ExcelScanKind
	HykHfKind
	Jphf3Kind
	MailScanKind
	OfficeBuildKind
	OfficeZipBuildKind
	PptxBuildKind
	SuperRecovery2Kind
	WordRepairerKind
	WordScanKind
	XlsxBuildKind
	ZipBuildKind
	InvalidAppKind
)

func ConvertInteger2AppKind

func ConvertInteger2AppKind[T constraints.Integer](v T) AppKind

func (AppKind) AssertKind

func (k AppKind) AssertKind(kinds string) AppKind

func (AppKind) Keys

func (k AppKind) Keys() []string

func (AppKind) Kinds

func (k AppKind) Kinds() []AppKind

func (AppKind) String

func (k AppKind) String() string

func (AppKind) SvgFileName

func (k AppKind) SvgFileName() string

type Buffer

type Buffer struct{ *bytes.Buffer }

func NewBuffer

func NewBuffer[T Type](s T) *Buffer

func NewHexDump

func NewHexDump(hexdumpStr HexDumpString) (data *Buffer)

func NewHexString

func NewHexString(s HexString) *Buffer

func ReaderGzip

func ReaderGzip[T Type](data T) *Buffer

func (*Buffer) AppendByteSlice

func (b *Buffer) AppendByteSlice(bytesSlice ...[]byte) []byte

func (*Buffer) BigNumXorWithAlign

func (b *Buffer) BigNumXorWithAlign(arg1, arg2 []byte, align int) (xorStream []byte)

func (*Buffer) CheckDesBlockSize

func (b *Buffer) CheckDesBlockSize()

func (*Buffer) Contains

func (b *Buffer) Contains(substr string) bool

func (*Buffer) CutString

func (b *Buffer) CutString(left, right string) (cut string, found bool)

func (*Buffer) CutWithIndex

func (b *Buffer) CutWithIndex(x, y int) []byte

func (*Buffer) HexString

func (b *Buffer) HexString() HexString

func (*Buffer) HexStringUpper

func (b *Buffer) HexStringUpper() HexString

func (*Buffer) Indent

func (b *Buffer) Indent(deep int)

func (*Buffer) InsertByte

func (b *Buffer) InsertByte(index int, ch byte)

func (*Buffer) InsertBytes

func (b *Buffer) InsertBytes(index int, insert []byte) []byte

func (*Buffer) InsertRune

func (b *Buffer) InsertRune(index int, r rune)

func (*Buffer) InsertString

func (b *Buffer) InsertString(index int, s string) string

func (*Buffer) InsertStringWithSplit

func (b *Buffer) InsertStringWithSplit(size int, insert string) string

func (*Buffer) LinesToString

func (b *Buffer) LinesToString(lines []string) string

func (*Buffer) MergeByte

func (b *Buffer) MergeByte(streams ...[]byte) []byte

func (*Buffer) NewLine

func (b *Buffer) NewLine() *Buffer

func (*Buffer) ObjectBegin

func (b *Buffer) ObjectBegin()

func (*Buffer) ObjectEnd

func (b *Buffer) ObjectEnd()

func (*Buffer) Quote

func (b *Buffer) Quote()

func (*Buffer) QuoteWith

func (b *Buffer) QuoteWith(s string) *Buffer

func (*Buffer) ReadBinary

func (b *Buffer) ReadBinary(order binary.ByteOrder) (data any)

func (*Buffer) ReaderGzip

func (b *Buffer) ReaderGzip() *Buffer

func (*Buffer) ReplaceAll

func (b *Buffer) ReplaceAll(old, new string) *Buffer

func (*Buffer) SliceBegin

func (b *Buffer) SliceBegin()

func (*Buffer) SliceEnd

func (b *Buffer) SliceEnd()

func (*Buffer) SplitBytes

func (b *Buffer) SplitBytes(size int) (blocks [][]byte)

func (*Buffer) SplitString

func (b *Buffer) SplitString(size int) (blocks []string)

func (*Buffer) ToLines

func (b *Buffer) ToLines() (lines []string)

func (*Buffer) WriteBinary

func (b *Buffer) WriteBinary(order binary.ByteOrder, data any)

func (*Buffer) WriteBytesLn

func (b *Buffer) WriteBytesLn(buf []byte) *Buffer

func (*Buffer) WritePackageName

func (b *Buffer) WritePackageName()

func (*Buffer) WriteStringLn

func (b *Buffer) WriteStringLn(s string) *Buffer

type CommandSession added in v0.0.16

type CommandSession struct {
	*exec.Cmd
	Result           string
	CurrentDirectory string
	// contains filtered or unexported fields
}

func NewCommandSession added in v0.0.16

func NewCommandSession() *CommandSession

func RunCommand

func RunCommand(command string) *CommandSession

func RunCommandArgs added in v0.0.16

func RunCommandArgs(arg ...string) *CommandSession

func (*CommandSession) GetPid added in v0.0.16

func (s *CommandSession) GetPid() <-chan int

func (*CommandSession) SetDir added in v0.0.16

func (s *CommandSession) SetDir(dir string)

func (*CommandSession) SetLog added in v0.0.16

func (s *CommandSession) SetLog(wr io.Writer)

type GeneratedFile

type GeneratedFile struct{ *Buffer }

func NewGeneratedFile added in v0.0.58

func NewGeneratedFile() *GeneratedFile

func (*GeneratedFile) Enum

func (g *GeneratedFile) Enum(kindName string, kinds, tooltip []string)

func (*GeneratedFile) P

func (g *GeneratedFile) P(v ...any)

func (*GeneratedFile) ReadTemplates

func (g *GeneratedFile) ReadTemplates(path, pkg string)

type HexDumpString

type HexDumpString string

type HexString

type HexString string

func SwapBytes2HexString

func SwapBytes2HexString(src []byte) (dst HexString)

type Pool added in v0.0.28

type Pool[T any] struct {
	// contains filtered or unexported fields
}

func NewPool added in v0.0.28

func NewPool[T any](fn func() T) *Pool[T]

func (*Pool[T]) Get added in v0.0.28

func (p *Pool[T]) Get() T

func (*Pool[T]) Put added in v0.0.28

func (p *Pool[T]) Put(v T)

type Type

type Type interface {
	string | HexString | HexDumpString | ~[]byte | ~*bytes.Buffer | *big.Int | *Buffer
}

Jump to

Keyboard shortcuts

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