common

package
v0.0.0-...-b6a2cce Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2018 License: MIT Imports: 3 Imported by: 6

Documentation

Index

Constants

View Source
const (
	StorageChannelCapacity         = 100
	StorageConcurrencyRoutineCount = 20
)
View Source
const (
	VerifyUrl = "http://www.baidu.com"
	TIME_OUT  = 5
	TITLE     = "百度一下,你就知道"
)

Validator

View Source
const (
	GetLimit = 20
)

model

View Source
const (
	UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
)

common

Variables

View Source
var (
	ErrModelLimitInvalid       = errors.New("limit Invalid")
	ErrStorageNotSupport       = errors.New("Storage Type Not Support")
	ErrMysqlHandlerNotInit     = errors.New("Mysql Handler Not Init")
	ErrConfigHandlerNotInit    = errors.New("Config Handler Not Init")
	ErrParserNotSupport        = errors.New("The Parser Not Support")
	ErrRedisHandlerNotInit     = errors.New("Redis Handler Not Init")
	ErrBeginPageNumLessThanOne = errors.New("BeginPageNum Shouldn't Less Than One")
	ErrEndPageNumLessThanZero  = errors.New("EndPageNum Shouldn't Less Than Zero")
)

Functions

func GetConfigHandler

func GetConfigHandler() *config

func InitConfig

func InitConfig(path string)

Types

type Duration

type Duration struct {
	time.Duration
}

Duration 配置中使用的时长

func (*Duration) D

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

D 从Duration struct中取出time.Duration类型的值

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) (err error)

UnmarshalText 将字符串形式的时长信息转换为Duration类型

type MysqlConfig

type MysqlConfig struct {
	Dsn     string // database dsn
	DbName  string
	MaxOpen int
	MaxIdle int
}

type ProxyPool

type ProxyPool struct {
	Storage string
}

type RedisConfig

type RedisConfig struct {
	Dsn      string
	Timeout  Duration
	Protocol string
	Db       int
}

type WebDetail

type WebDetail struct {
	Name             string
	TaskType         string
	BeginPageNum     int
	EndPageNum       int
	TimeInterval     Duration
	LoopTimeInterval Duration
}

func (*WebDetail) Validation

func (w *WebDetail) Validation() error

Jump to

Keyboard shortcuts

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