tools

package
v1.3.4-alpha0727 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package tools @Author bcy2007 2023/7/12 16:40

Package tools @Author bcy2007 2023/7/14 14:54

Package tools @Author bcy2007 2023/7/13 15:49

Package tools @Author bcy2007 2023/7/12 16:38

Package tools @Author bcy2007 2023/7/12 16:36

Index

Constants

This section is empty.

Variables

View Source
var ErrIsEmpty = errors.New("ring buffer is empty")

Functions

func CheckFileExist

func CheckFileExist(fileName string) bool

验证文件(目录)是否存在

func CreateDir

func CreateDir(path string) error

调用os.MkdirAll递归创建文件夹

func GetFileTmpName

func GetFileTmpName(preString string, rand int) string

获取一个随机的临时文件名

func GetRandomString

func GetRandomString(n int) string

func IsDir

func IsDir(path string) bool

判断所给路径是否为文件夹

func IsFile

func IsFile(path string) bool

判断所给路径是否为文件

func ReadFile

func ReadFile(path string) ([]byte, error)

读取文件到二进制

func RemoveFile

func RemoveFile(path string) error

删除文件

func WriteFile

func WriteFile(fileName string, strTest []byte) error

写入二进制到文件

Types

type Counter

type Counter struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewCounter

func NewCounter(number int) *Counter

func (*Counter) Add

func (c *Counter) Add() bool

func (*Counter) LayDown

func (c *Counter) LayDown() bool

func (*Counter) Minus

func (c *Counter) Minus() bool

func (*Counter) Number

func (c *Counter) Number() int

func (*Counter) OverLoad

func (c *Counter) OverLoad() bool

func (*Counter) Wait

func (c *Counter) Wait(num int)

type RingBuffer

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

RingBuffer

@Description: https://github.com/zngw/zchan

func NewRingBuffer

func NewRingBuffer(cellSize int) (buf *RingBuffer, err error)

func (*RingBuffer) Capacity

func (ringBuffer *RingBuffer) Capacity() int

func (*RingBuffer) IsEmpty

func (ringBuffer *RingBuffer) IsEmpty() bool

func (*RingBuffer) Len

func (ringBuffer *RingBuffer) Len() (count int)

func (*RingBuffer) Peek

func (ringBuffer *RingBuffer) Peek() (data T)

func (*RingBuffer) Pop

func (ringBuffer *RingBuffer) Pop() (data T)

func (*RingBuffer) Read

func (ringBuffer *RingBuffer) Read() (data T, err error)

func (*RingBuffer) Reset

func (ringBuffer *RingBuffer) Reset()

func (*RingBuffer) Write

func (ringBuffer *RingBuffer) Write(value T)

type StringCountFilter

type StringCountFilter struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewCountFilter

func NewCountFilter() *StringCountFilter

func NewStringCountFilter

func NewStringCountFilter(config *filter.Config, container *cuckoo.Filter) *StringCountFilter

func (*StringCountFilter) Count

func (s *StringCountFilter) Count() int64

func (*StringCountFilter) Exist

func (s *StringCountFilter) Exist(str string) bool

func (*StringCountFilter) Insert

func (s *StringCountFilter) Insert(str string) bool

type T

type T interface{}

type UChan

type UChan struct {
	In  chan<- T
	Out <-chan T
	// contains filtered or unexported fields
}

func NewUChan

func NewUChan(initCapacity int) (ch *UChan, err error)

func (*UChan) BufLen

func (uChan *UChan) BufLen() int

func (*UChan) Len

func (uChan *UChan) Len() int

type UrlNode

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

func CreateNode

func CreateNode(url string, level int) *UrlNode

func (*UrlNode) Add

func (node *UrlNode) Add(url string) *UrlNode

func (*UrlNode) Level

func (node *UrlNode) Level() int

func (*UrlNode) Next

func (node *UrlNode) Next(nextNode *UrlNode)

type UrlTree

type UrlTree struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func CreateTree

func CreateTree(url string) *UrlTree

func (*UrlTree) Add

func (tree *UrlTree) Add(parent string, sons ...string)

func (*UrlTree) Count

func (tree *UrlTree) Count() int

func (*UrlTree) Find

func (tree *UrlTree) Find(url string) *UrlNode

func (*UrlTree) Has added in v1.2.7

func (tree *UrlTree) Has(url string) bool

func (*UrlTree) Level

func (tree *UrlTree) Level() int

func (*UrlTree) Show

func (tree *UrlTree) Show() string

Directories

Path Synopsis
Package config https://github.com/unknwon/goconfig
Package config https://github.com/unknwon/goconfig

Jump to

Keyboard shortcuts

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