service

package
v0.0.0-...-ec7097f Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2017 License: MIT Imports: 13 Imported by: 4

Documentation

Index

Constants

View Source
const (
	INDEX_CACHE        = "index"
	ALL_RANK_CACHE     = "all_rank"
	BANGUMI_CACHE      = "bangumi"
	BANGUMI_LIST_CACHE = "bangumi_list"
	SORT_TOP_CACHE     = "sort-"
	LIVE_INDEX_CACHE   = "live_index"
	INDEX_BANNER_CACHE = "index_banner"
)

Variables

Functions

func ConformRoute

func ConformRoute(app *BiliBiliApplication)

func MakeFailedJsonMap

func MakeFailedJsonMap(code string, message string) map[string]string

Types

type BangumiInfoTask

type BangumiInfoTask struct {
	CornTask
	// contains filtered or unexported fields
}

func (*BangumiInfoTask) Run

func (i *BangumiInfoTask) Run() error

type BangumiListTask

type BangumiListTask struct {
	CornTask
	// contains filtered or unexported fields
}

func (*BangumiListTask) Run

func (i *BangumiListTask) Run() error

type BannerTask

type BannerTask struct {
	CornTask
	// contains filtered or unexported fields
}

func (*BannerTask) Run

func (b *BannerTask) Run() error

type BiliBiliApplication

type BiliBiliApplication struct {
	Router *gin.Engine
	Corn   *CornService
	Conf   *Config
	Client *client.BCli
	Cache  *CacheManager
}

func NewApplication

func NewApplication(configFile string) (*BiliBiliApplication, error)

type CacheManager

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

func NewCacheManager

func NewCacheManager() *CacheManager

func (*CacheManager) GetCache

func (c *CacheManager) GetCache(key string) interface{}

func (*CacheManager) SetCache

func (c *CacheManager) SetCache(key string, value interface{})

type Config

type Config struct {
	Debug     bool   `json:"debug"`
	Appkey    string `json:"appkey"`
	Secret    string `json:"secret"`
	AllowHost string `json:"allow_host"`
	IsPrivate bool   `json:"private"`
}

func ReadConfigFromFile

func ReadConfigFromFile(filename string) (*Config, error)

type CornService

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

func NewCornService

func NewCornService() *CornService

func (*CornService) RegisterTask

func (c *CornService) RegisterTask(task CornTaskImpl)

func (*CornService) Start

func (c *CornService) Start()

func (*CornService) Stop

func (c *CornService) Stop()

type CornTask

type CornTask struct {
	Name     string
	Duration time.Duration
	LastRun  time.Time
}

func (*CornTask) Failure

func (t *CornTask) Failure(err error)

func (*CornTask) GetDuration

func (t *CornTask) GetDuration() time.Duration

func (*CornTask) GetLastRun

func (t *CornTask) GetLastRun() time.Time

func (*CornTask) GetName

func (t *CornTask) GetName() string

func (*CornTask) Run

func (t *CornTask) Run() error

func (*CornTask) Success

func (t *CornTask) Success()

func (*CornTask) SyncLastRunTime

func (t *CornTask) SyncLastRunTime()

type CornTaskImpl

type CornTaskImpl interface {
	Run() error
	Success()
	Failure(error)
	GetName() string
	GetDuration() time.Duration
	GetLastRun() time.Time
	SyncLastRunTime()
}

type IndexInfoTask

type IndexInfoTask struct {
	CornTask
	// contains filtered or unexported fields
}

func (*IndexInfoTask) Run

func (i *IndexInfoTask) Run() error

type LiveIndexTask

type LiveIndexTask struct {
	CornTask
	// contains filtered or unexported fields
}

func (*LiveIndexTask) Run

func (i *LiveIndexTask) Run() error

type SortRankInfo

type SortRankInfo struct {
	SortId int           `json:"sort_id"`
	Videos []interface{} `json:"videos"`
}

type TopRankTask

type TopRankTask struct {
	CornTask
	// contains filtered or unexported fields
}

func (*TopRankTask) Run

func (i *TopRankTask) Run() error

Jump to

Keyboard shortcuts

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