tools

package
v0.0.0-...-cbf1298 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

*********************************************************************************************** *** G O L A N D *** *********************************************************************************************** * Auth: ColeCai * Date: 2023/10/19 13:18:32 * Proj: work * Pack: tools * File: excel.go *---------------------------------------------------------------------------------------------- * Overviews: *---------------------------------------------------------------------------------------------- * Functions: * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

*********************************************************************************************** *** G O L A N D *** *********************************************************************************************** * Auth: ColeCai * Date: 2023/10/23 14:43:29 * Proj: work * Pack: tools * File: psutil.go *---------------------------------------------------------------------------------------------- * Overviews: *---------------------------------------------------------------------------------------------- * Functions: * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

*********************************************************************************************** *** G O L A N D *** *********************************************************************************************** * Auth: ColeCai * Date: 2023/10/19 13:19:08 * Proj: work * Pack: tools * File: tools.go *---------------------------------------------------------------------------------------------- * Overviews: *---------------------------------------------------------------------------------------------- * Functions: * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Index

Constants

View Source
const (
	Number         string = "0123456789"
	Lower          string = "abcdefghijklmnopqrstuvwxyz"
	Upper          string = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	Alpha          string = Lower + Upper
	NumberAndLower string = Number + Lower
	NumberAndUpper string = Number + Upper
	NumberAndAlpha string = Number + Alpha
)

Variables

This section is empty.

Functions

func BytesToString

func BytesToString(b []byte) string

func GetMessageName

func GetMessageName(m proto.Message) string

func GetRandomString

func GetRandomString(l int, with WithBase) string

func GetRandomToken

func GetRandomToken() string

func MatrixIntsToStrs

func MatrixIntsToStrs[T constraints.Integer](arrays [][]T) [][]string

func MatrixStrsToInts

func MatrixStrsToInts[T constraints.Integer](arrays [][]string) ([][]T, error)

func NewProtoMessage

func NewProtoMessage(name string) (proto.Message, error)

func ReverseSlice

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

func SliceCntElem

func SliceCntElem[T comparable](slice []T, elem T) int

func SliceDelElemAll

func SliceDelElemAll[T comparable](slice []T, elem T) []T

func SliceHasElem

func SliceHasElem[T comparable](slice []T, elem T) bool

func SliceIntsToStrs

func SliceIntsToStrs[T constraints.Integer](array []T) []string

func SliceStrsToInts

func SliceStrsToInts[T constraints.Integer](array []string) ([]T, error)

func SliceStrsToInts1

func SliceStrsToInts1[T constraints.Integer](array []string, tp []T) error

func SlicesDifferSet

func SlicesDifferSet[T comparable](slice1, slice2 []T) []T

func SlicesInterSet

func SlicesInterSet[T comparable](slice1, slice2 []T) []T

func StringToBytes

func StringToBytes(s string) []byte

func WithAlpha

func WithAlpha() string

func WithLower

func WithLower() string

func WithNumberAndAlpha

func WithNumberAndAlpha() string

func WithNumberAndLower

func WithNumberAndLower() string

func WithNumberAndUpper

func WithNumberAndUpper() string

func WithNumnber

func WithNumnber() string

func WithUpper

func WithUpper() string

Types

type BytePool

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

func NewBytePool

func NewBytePool(size, cap int) *BytePool

func (*BytePool) Get

func (p *BytePool) Get() []byte

func (*BytePool) Put

func (p *BytePool) Put(b interface{})

func (*BytePool) PutWithReset

func (p *BytePool) PutWithReset(b []byte)

type Delay

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

func NewDelay

func NewDelay(maxDelay time.Duration) *Delay

func (*Delay) Delay

func (d *Delay) Delay()

func (*Delay) Duration

func (d *Delay) Duration() time.Duration

func (*Delay) Reset

func (d *Delay) Reset()

type Excel

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

func (*Excel) Close

func (e *Excel) Close()

func (*Excel) GetCellValue

func (e *Excel) GetCellValue(sheetName, pos string) (string, error)

func (*Excel) GetColMatrix

func (e *Excel) GetColMatrix(sheetName, startPos, endPos string) ([][]string, error)

列做一维

func (*Excel) GetColsValue

func (e *Excel) GetColsValue(sheetName, startPos, endPos string) ([]string, error)

按列获取

func (*Excel) GetRowMatrix

func (e *Excel) GetRowMatrix(sheetName, startPos, endPos string) ([][]string, error)

行做一维

func (*Excel) GetRowsValue

func (e *Excel) GetRowsValue(sheetName, startPos, endPos string) ([]string, error)

按行获取

func (*Excel) Open

func (e *Excel) Open(file string) error

type ProcSysInfo

type ProcSysInfo struct {
	Pid        int
	Name       string
	CPUPercent float64
	MemPercent float64
	UsedMem    uint64
	CreatTime  int64
}

func GetProcSysInfo

func GetProcSysInfo() (*ProcSysInfo, error)

type WithBase

type WithBase func() string

Jump to

Keyboard shortcuts

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