Documentation
¶
Index ¶
- Constants
- Variables
- func CheckArray(values []string, name string) []string
- func CheckCondition(condition bool, description string)
- func CheckErr(err error)
- func CheckErrf(err error, description string)
- func CheckMap(m map[string]string, name string) map[string]string
- func CheckMapInf(m map[string]interface{}, name string) map[string]interface{}
- func CheckNil(v interface{}, name string)
- func CheckStr(value string, name string) string
- func Contains(s []string, e string) bool
- func Convert(text string) string
- func ConvertDateString(date string) int64
- func ConvertTimestamp(timestamp string) time.Time
- func Decode(str string, v interface{}) error
- func DoRequest(url string, body string) (string, error)
- func Encode(v interface{}) (string, error)
- func Get(targetUrl string, debug bool) (string, error)
- func GetBool(key string) bool
- func GetInt(key string) int
- func GetNowMillionSecond() int64
- func GetNumber(version string) int
- func GetPool(url string, password string, db int) *redis.Pool
- func GetRedisPool(url string) *redis.Pool
- func GetString(key string) string
- func GetStringSlice(key string) []string
- func InitConfig()
- func InitQueue(maxWorkers int, queueSize int)
- func Min(x, y int) int
- func NewMgoSession(url string, mode mgo.Mode) *mgo.Session
- func NewMongoSession(host string, port int) *mgo.Session
- func NewRedisPool(host string, port int) *redis.Pool
- func Post(targetUrl string, content string, debug bool) (string, error)
- func RandomAny(n int) string
- func RandomInt(min int, max int) int
- func RandomStr(n int) string
- func Sign(input string) string
- func ToInstance(str string, v interface{}) error
- func ToJsonString(v interface{}) (string, error)
- func Uniq(src []string) []string
- type Dispatcher
- type Entity
- type Job
- type Log
- type Operator
- type RedisService
- func (self *RedisService) Get(key string, result interface{}) error
- func (self *RedisService) HGETALL(hash string) (map[string]int, error)
- func (self *RedisService) HINCRBY(hash string, key string, val int) error
- func (self *RedisService) Lpop() (string, error)
- func (self *RedisService) Rpush(v interface{}) error
- func (self *RedisService) Set(key string, v interface{}, ttl int) error
- func (self *RedisService) Size() (int, error)
- type Service
- func (self *Service) All(results interface{}) error
- func (self *Service) Empty() error
- func (self *Service) Exists(query interface{}) bool
- func (self *Service) Find(id string, result interface{}) error
- func (self *Service) FindByDate(date string, results interface{}) error
- func (self *Service) FindByName(name string, results interface{}) error
- func (self *Service) FindByTimestamp(start string, end string, results interface{}) error
- func (self *Service) FindOne(query interface{}, result interface{}) error
- func (self *Service) Insert(doc interface{}) error
- func (self *Service) Remove(id string) error
- func (self *Service) Search(query interface{}, results interface{}) error
- func (self *Service) Update(selector interface{}, update interface{}) error
- type Task
- type TaskService
- type Worker
Constants ¶
View Source
const ( HIGH uint = iota NORMAL LOW )
Variables ¶
View Source
var JobQueue chan Job
View Source
var Letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
View Source
var TraditionalDict = map[string]string{}/* 2542 elements not displayed */
Functions ¶
func CheckArray ¶
func CheckCondition ¶
func CheckMapInf ¶
func ConvertDateString ¶
func ConvertTimestamp ¶
func GetNowMillionSecond ¶
func GetNowMillionSecond() int64
func GetRedisPool ¶
func GetStringSlice ¶
func InitConfig ¶
func InitConfig()
func ToInstance ¶
func ToJsonString ¶
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
func NewDispatcher ¶
func NewDispatcher(maxWorkers int) *Dispatcher
func (*Dispatcher) Run ¶
func (d *Dispatcher) Run()
func (*Dispatcher) Workload ¶
func (d *Dispatcher) Workload() int
type Operator ¶
type Operator interface {
All(interface{}) error
Insert(interface{}) error
Update(interface{}, interface{}) error
Remove(string) error
Empty() error
Find(string, interface{}) error
FindByDate(string, interface{}) error
FindByName(string, interface{}) error
FindByTimestamp(string, string, interface{}) error
FindOne(interface{}, interface{}) error
Search(interface{}, interface{}) error
Exists(query interface{}) bool
}
type RedisService ¶
type RedisService struct {
// contains filtered or unexported fields
}
func NewRedisService ¶
func NewRedisService(pool *redis.Pool, list string) *RedisService
func (*RedisService) Get ¶
func (self *RedisService) Get(key string, result interface{}) error
func (*RedisService) HGETALL ¶
func (self *RedisService) HGETALL(hash string) (map[string]int, error)
func (*RedisService) HINCRBY ¶
func (self *RedisService) HINCRBY(hash string, key string, val int) error
func (*RedisService) Lpop ¶
func (self *RedisService) Lpop() (string, error)
func (*RedisService) Rpush ¶
func (self *RedisService) Rpush(v interface{}) error
func (*RedisService) Size ¶
func (self *RedisService) Size() (int, error)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) FindByDate ¶
func (*Service) FindByName ¶
func (*Service) FindByTimestamp ¶
type Task ¶
type TaskService ¶
type TaskService struct {
*RedisService
}
func NewTaskService ¶
func NewTaskService(redisService *RedisService) *TaskService
func (*TaskService) Deq ¶
func (self *TaskService) Deq() (*Task, error)
func (*TaskService) Enq ¶
func (self *TaskService) Enq(content interface{}) error
type Worker ¶
type Worker struct {
WorkerPool chan chan Job
JobChannel chan Job
// contains filtered or unexported fields
}
Worker represents the worker that executes the job
Source Files
¶
Click to show internal directories.
Click to hide internal directories.