mod

package module
v0.0.0-...-c9a58ef Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

README

mod

Provide some common methods for easy golang development

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckError

func CheckError(e error)

func Info

func Info(o interface{})

func RunPath

func RunPath() string

Types

type FileClass

type FileClass struct {
}

IO类操作

func NewFile

func NewFile() *FileClass

func (*FileClass) AppendString

func (*FileClass) AppendString(path string, data string) error

func (*FileClass) ReadString

func (*FileClass) ReadString(path string) (string, error)

func (*FileClass) WriteString

func (*FileClass) WriteString(path string, data string) error

type GoroutinePool

type GoroutinePool struct {
	TaskChannel    chan Task
	AddTaskChannel chan Task
	// contains filtered or unexported fields
}

type GoroutinePool

func NewGoroutinePool

func NewGoroutinePool(wokerNum int) *GoroutinePool

func (*GoroutinePool) Run

func (pool *GoroutinePool) Run()

type HttpClass

type HttpClass struct {
	HttpClient http.Client
}

http处理类

func NewHttp

func NewHttp() *HttpClass

func (*HttpClass) AddCookie

func (t *HttpClass) AddCookie(old string, new string) string

httpClass.AddCookie 合并2个Cookie

func (*HttpClass) Get

func (t *HttpClass) Get(url string, header map[string]string) (*HttpClassRet, error)

httpClass.Get

func (*HttpClass) Post

func (t *HttpClass) Post(url string, body string, header map[string]string) (*HttpClassRet, error)

httpClass.Post

type HttpClassRet

type HttpClassRet struct {
	Body   string
	Cookie string
	Header http.Header
}

type StringsClass

type StringsClass struct {
}

字符串处理类

func NewStrings

func NewStrings() *StringsClass

func (*StringsClass) BetweenStr

func (*StringsClass) BetweenStr(str, start, end string) string

截取中间字符串

func (*StringsClass) FitterKeyWords

func (*StringsClass) FitterKeyWords(input string, words []string) bool

关键词组过滤,检查是否存在

func (*StringsClass) RandomInt

func (*StringsClass) RandomInt(s, e int) string

获取随机 Math.random

func (*StringsClass) SimilarText

func (*StringsClass) SimilarText(first, second string, percent *float64) int

字符串相似度

type Task

type Task struct {
	F func(map[string]string)
	P map[string]string
}

func (*Task) Exec

func (t *Task) Exec()

type TimeClass

type TimeClass struct {
}

时间类

func NewTime

func NewTime() *TimeClass

func (*TimeClass) Random

func (*TimeClass) Random() string

获取随机16位小数 Math.random

func (*TimeClass) TimeStamp

func (*TimeClass) TimeStamp(size int) string

时间戳 10,13

func (*TimeClass) Timer

func (*TimeClass) Timer(t time.Duration, f func()) *TimerRet

定时器

type TimerRet

type TimerRet struct {
	StopCannel chan interface{}
}

Jump to

Keyboard shortcuts

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