stream

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 36 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)))`) // todo panic
	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 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 CheckLoopvarAndNilPoint

func CheckLoopvarAndNilPoint()

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 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 FileExists

func FileExists(path string) bool

func FixUncPath

func FixUncPath(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 GenXiLa26

func GenXiLa26() (letters []string)

GenXiLa26 生成26个希腊字母

func GenerateRandomNumber

func GenerateRandomNumber(max int) int

func GetDiffDays

func GetDiffDays(dstTime string) string

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, err error)

func GitProxy

func GitProxy(isSetProxy bool)

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 IsDirRoot added in v0.0.6

func IsDirRoot(path string) bool

IsDirRoot 是否是一级目录,包含目录分隔符的深度一定大于1

func IsDragonfly

func IsDragonfly() bool

func IsFilePath

func IsFilePath(input string) 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

Lines returns the lines in the file x, including newlines. If the file does not end in a newline, one is supplied along with a warning about the missing newline.

func MakeArg

func MakeArg(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) (err error)

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 RandomNum

func RandomNum(min, max int) int

func ReadEmbedFilesToMap added in v0.0.7

func ReadEmbedFilesToMap(embedFiles embed.FS, dirname string) *maps.SafeMap[string, []byte]

func ReadFileAndWriteTruncate

func ReadFileAndWriteTruncate(path, dstPath string)

func ReadFileSubTimeWithCallBack

func ReadFileSubTimeWithCallBack(title, path string, callBack func(string))

func ReadFileToLines

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

func ReadLines

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

func RegexpWebBodyBlocks

func RegexpWebBodyBlocks(tagName string) string

func RunDir

func RunDir() string

func RunDirAbs

func RunDirAbs() string

func SerialNumber

func SerialNumber(b string) string

SerialNumber 这个才是swap功能,前后字节交换顺序

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)

SplitFileByLines 按行数切割文件

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)

SwapBytes2HexString2 逆序,并不是交换 todo 重命名为 Reverse,如果输入参数复合8字节以下的字节对齐可以用二进制包,不过不通用

func ToCamel

func ToCamel(data string, isCommit bool) string

//////////////caseconv todo copy core

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)

todo merge all safe type here, and move stream lines method here

func TrimExtension

func TrimExtension(path 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

//////////////hex string

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

/////////////////////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 GeneratedFile

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

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 string)

type HexDumpString

type HexDumpString string

////////////////////hex dump/

type HexString

type HexString string

func SwapBytes2HexString

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

type Interface

type Interface interface {
	P(v ...any)
	Enum(kindName string, kinds []string, tooltip []string)
	ReadTemplates(path string)
}

func NewGen added in v0.0.6

func NewGen() Interface

type Session

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

func NewSession

func NewSession() *Session

func RunArgs

func RunArgs(arg ...string) *Session

func RunCommand

func RunCommand(command string) *Session

func (*Session) GetPid

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

func (*Session) SetDir

func (s *Session) SetDir(dir string)

func (*Session) SetLog

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

type Type

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

Directories

Path Synopsis
Package constraints defines a set of useful constraints to be used with type parameters.
Package constraints defines a set of useful constraints to be used with type parameters.
Package datasize provides a data size type and constants.
Package datasize provides a data size type and constants.
net
httpClient
<nilaway struct enable>
<nilaway struct enable>
transport/tcp/m command
script

Jump to

Keyboard shortcuts

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