utils

package
v0.0.1-dev.4 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LOG = NewLogger()

Functions

func Get2Json

func Get2Json(url string, res interface{}) error

func Get2String

func Get2String(url string) (string, error)

func GetStackTrace

func GetStackTrace() string

func NewContextHook

func NewContextHook(levels ...logrus.Level) logrus.Hook

NewContextHook use to make an hook 根据上面的推断, 我们递归深度可以设置到5即可.

func NewLogger

func NewLogger() *logrus.Logger

func Post2Json

func Post2Json(url string, data url.Values, res interface{}) error

func StringToUint8

func StringToUint8(str string) uint8

func Uint8ToString

func Uint8ToString(uint8s []uint8) string

Types

type AsyncPriorityQueue

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

func NewAsyncPriorityQueue

func NewAsyncPriorityQueue() *AsyncPriorityQueue

func (*AsyncPriorityQueue) Pop

func (this *AsyncPriorityQueue) Pop() interface{}

func (*AsyncPriorityQueue) Push

func (this *AsyncPriorityQueue) Push(value interface{})

func (*AsyncPriorityQueue) PushWithPriority

func (this *AsyncPriorityQueue) PushWithPriority(value interface{}, priority int64)

type AsyncQueue

type AsyncQueue struct {
	*Queue
	// contains filtered or unexported fields
}

A thread safe version of Queue.

func NewAsyncQueue

func NewAsyncQueue() *AsyncQueue

Returns an initialized SyncQueue

func (*AsyncQueue) Front

func (q *AsyncQueue) Front() *list.Element

Same as Front for Queue, except it is thread safe.

func (*AsyncQueue) IsEmpty

func (q *AsyncQueue) IsEmpty() bool

Same as IsEmpty for Queue, except it is thread safe.

func (*AsyncQueue) Len

func (q *AsyncQueue) Len() int

Same as Len for Queue, except it is thread safe.

func (*AsyncQueue) Next

func (q *AsyncQueue) Next(e *list.Element) *list.Element

Same as Next for Queue, except it is thread safe.

func (*AsyncQueue) Pop

func (q *AsyncQueue) Pop() interface{}

Same as Pop for Queue, except it is thread safe.

func (*AsyncQueue) Push

func (q *AsyncQueue) Push(o interface{})

Same as Push for Queue, except it is thread safe.

type AsyncSet

type AsyncSet struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewAsyncSet

func NewAsyncSet() *AsyncSet

func (*AsyncSet) Add

func (rm *AsyncSet) Add(e interface{}) bool

add specified element to set, return true if this set did not contain this element.

func (*AsyncSet) Clear

func (rm *AsyncSet) Clear() int

func (*AsyncSet) Contains

func (rm *AsyncSet) Contains(e interface{}) bool

func (*AsyncSet) IsEmpty

func (rm *AsyncSet) IsEmpty() bool

func (*AsyncSet) Remove

func (rm *AsyncSet) Remove(e interface{}) bool

func (*AsyncSet) Size

func (rm *AsyncSet) Size() int

type Item

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

An Item is something we manage in a priority queue.

type MyFormatter

type MyFormatter struct {
}

type PriorityQueue

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

func NewPriorityQueue

func NewPriorityQueue() *PriorityQueue

func (*PriorityQueue) Pop

func (this *PriorityQueue) Pop() interface{}

func (*PriorityQueue) Push

func (this *PriorityQueue) Push(value interface{})

func (*PriorityQueue) PushWithPriority

func (this *PriorityQueue) PushWithPriority(value interface{}, priority int64)

type Queue

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

Queue represents the FIFO queue.

func NewQueue

func NewQueue() *Queue

Returns an initialized Queue.

func (*Queue) Dead

func (q *Queue) Dead() bool

func (*Queue) Front

func (q *Queue) Front() *list.Element

Returns the item at the front of the Queue or nil. The item is a *list.Element from the 'container/list' package.

func (*Queue) IsEmpty

func (q *Queue) IsEmpty() bool

Checks to see if the Queue is empty.

func (*Queue) Kill

func (q *Queue) Kill()

func (*Queue) Len

func (q *Queue) Len() int

Returns the current length of the Queue.

func (*Queue) Next

func (q *Queue) Next(e *list.Element) *list.Element

Returns the item after e or nil it is the last item or nil. The item is a *list.Element from the 'container/list' package. Even though it is possible to call e.Next() directly, don't. This behavior may not be supported moving forward.

func (*Queue) Pop

func (q *Queue) Pop() interface{}

Removes an item from the front of the Queue and returns it's value or nil.

func (*Queue) Push

func (q *Queue) Push(o interface{})

Pushes a new item to the back of the Queue.

type Set

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

func NewSet

func NewSet() *Set

func (*Set) Add

func (this *Set) Add(e interface{}) bool

func (*Set) Clear

func (this *Set) Clear() int

func (*Set) Contains

func (this *Set) Contains(e interface{}) bool

func (*Set) IsEmpty

func (this *Set) IsEmpty() bool

func (*Set) Remove

func (this *Set) Remove(e interface{}) bool

func (*Set) Size

func (this *Set) Size() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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