utils

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: Unlicense Imports: 15 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareMap

func CompareMap(defaultMap map[interface{}]interface{}, newMap map[interface{}]interface{}) map[interface{}]interface{}

func CopyBytes added in v0.0.5

func CopyBytes(b []byte) (copiedBytes []byte)

CopyBytes返回所提供字节的精确副本。

func Encode

func Encode(b []byte) string

Encode将b编码为前缀为0x的十六进制字符串。

func GetColorStr

func GetColorStr(color string, isHighLighted bool, str string) string

func GetInToStr

func GetInToStr(value interface{}) string

func GetRandomStr

func GetRandomStr(num int) string

func Hex2Bytes added in v0.0.5

func Hex2Bytes(str string) []byte

func ReadFileLine

func ReadFileLine(path string) []string

func ReadYaml

func ReadYaml(path string) map[interface{}]interface{}

func ScheduleTask

func ScheduleTask()

func SetTime

func SetTime(hour, min, second int) (d time.Duration)

func WriteFileLine

func WriteFileLine(path string, str string)

Types

type Jobs

type Jobs interface {
	Close()
	Execute()
}

type Pool

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

func NewPool

func NewPool(max int) *Pool

func (*Pool) Close

func (p *Pool) Close()

关闭池

func (*Pool) PutJobs

func (p *Pool) PutJobs(d Jobs)

将连接返回池中

func (*Pool) Start

func (p *Pool) Start()

type Prque added in v0.0.5

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

优先级队列数据结构。

func NewPrque added in v0.0.6

func NewPrque(setIndex SetIndexCallback) *Prque

新建创建新的优先级队列。

func NewWrapAround added in v0.0.5

func NewWrapAround(setIndex SetIndexCallback) *Prque

newwrapparound使用环绕优先级处理创建新的优先级队列。

func (*Prque) Empty added in v0.0.5

func (p *Prque) Empty() bool

检查优先级队列是否为空。

func (*Prque) Peek added in v0.0.5

func (p *Prque) Peek() (interface{}, int64)

Peek返回具有greates优先级的值,但不会将其弹出。

func (*Prque) Pop added in v0.0.5

func (p *Prque) Pop() (interface{}, int64)

从堆栈中弹出具有greates优先级的值并返回它。目前未进行收缩。

func (*Prque) PopItem added in v0.0.5

func (p *Prque) PopItem() interface{}

仅从队列中弹出项目,删除关联的优先级值。

func (*Prque) Push added in v0.0.5

func (p *Prque) Push(data interface{}, priority int64)

将具有给定优先级的值推送到队列中,必要时进行扩展。

func (*Prque) Remove added in v0.0.5

func (p *Prque) Remove(i int) interface{}

Remove删除具有给定索引的元素。

func (*Prque) Reset added in v0.0.5

func (p *Prque) Reset()

清除优先级队列的内容。

func (*Prque) Size added in v0.0.5

func (p *Prque) Size() int

返回优先级队列中的元素数。

type SetIndexCallback added in v0.0.5

type SetIndexCallback func(data interface{}, index int)

* 当元素移动到新索引时,将调用SetIndexCallback。提供SetIndexCallback是可选的,只有当应用程序需要删除除顶部元素以外的其他元素时才需要它。

type StorageSize added in v0.0.5

type StorageSize float64

StorageSize is a wrapper around a float value that supports user friendly formatting.

func (StorageSize) String added in v0.0.5

func (s StorageSize) String() string

String implements the stringer interface.

func (StorageSize) TerminalString added in v0.0.5

func (s StorageSize) TerminalString() string

TerminalString implements log.TerminalStringer, formatting a string for console output during logging.

Jump to

Keyboard shortcuts

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