service

package
v0.0.0-...-83adff0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TotalType total type
	TotalType int = iota
	// CreativeType creative type
	CreativeType
	// InfluenceType influence type
	InfluenceType
	// CreditType Credit type
	CreditType
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AscHeap

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

AscHeap for asc

func (*AscHeap) Len

func (a *AscHeap) Len() int

Len len

func (*AscHeap) Less

func (a *AscHeap) Less(i, j int) bool

Less less

func (*AscHeap) Pop

func (a *AscHeap) Pop() interface{}

Pop pop from heap

func (*AscHeap) Push

func (a *AscHeap) Push(x interface{})

Push push to heap

func (*AscHeap) Put

func (a *AscHeap) Put(diff *model.Diff)

Put put diff to heap

func (*AscHeap) Result

func (a *AscHeap) Result() []*model.Diff

Result get result

func (*AscHeap) Swap

func (a *AscHeap) Swap(i, j int)

Swap swap

type DescHeap

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

DescHeap for desc

func (*DescHeap) Len

func (d *DescHeap) Len() int

Len len

func (*DescHeap) Less

func (d *DescHeap) Less(i, j int) bool

Less less

func (*DescHeap) Pop

func (d *DescHeap) Pop() interface{}

Pop pop from desc heap

func (*DescHeap) Push

func (d *DescHeap) Push(x interface{})

Push push to desc heap

func (*DescHeap) Put

func (d *DescHeap) Put(diff *model.Diff)

Put to descHeap

func (*DescHeap) Result

func (d *DescHeap) Result() []*model.Diff

Result desc heap result

func (*DescHeap) Swap

func (d *DescHeap) Swap(i, j int)

Swap swap

type Heap

type Heap interface {
	Put(*model.Diff)
	Result() []*model.Diff
}

Heap for diff topK

type RatingHeap

type RatingHeap []*model.TopRating

RatingHeap rating heap for topK

func (RatingHeap) Len

func (r RatingHeap) Len() int

Len len

func (RatingHeap) Less

func (r RatingHeap) Less(i, j int) bool

Less less

func (*RatingHeap) Pop

func (r *RatingHeap) Pop() interface{}

Pop pop from heap

func (*RatingHeap) Push

func (r *RatingHeap) Push(x interface{})

Push push to heap

func (RatingHeap) Swap

func (r RatingHeap) Swap(i, j int)

Swap swap

type Service

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

Service struct

func New

func New(c *conf.Config) (s *Service)

New fn

func (*Service) BaseInfo

func (s *Service) BaseInfo(c context.Context, date time.Time, start, end int, ch chan []*model.BaseInfo) (err error)

BaseInfo get base infos

func (*Service) BaseInfoOffEnd

func (s *Service) BaseInfoOffEnd(c context.Context, date time.Time) (offset, end int, err error)

BaseInfoOffEnd get offset and end

func (*Service) BaseTotal

func (s *Service) BaseTotal(c context.Context, date time.Time) (total map[int64]*model.BaseInfo, err error)

BaseTotal get total base

func (*Service) BatchInsertRatingStat

func (s *Service) BatchInsertRatingStat(c context.Context, wch chan []*model.Rating, date time.Time) (err error)

BatchInsertRatingStat batch insert rating stat

func (*Service) CalScore

func (s *Service) CalScore(rch chan []*model.BaseInfo,
	wch chan []*model.Rating,
	params *model.RatingParameter,
	past map[int64]*model.Past, date time.Time)

CalScore cal rating score

func (*Service) CalScores

func (s *Service) CalScores(c context.Context, date time.Time, past map[int64]*model.Past, params *model.RatingParameter) (err error)

CalScores cal scores

func (*Service) CalTrend

func (s *Service) CalTrend(c context.Context, date time.Time) (err error)

CalTrend cal trend

func (*Service) Close

func (s *Service) Close()

Close close the service

func (*Service) Copy

func (s *Service) Copy(rch chan []*model.Rating, wch chan []*model.Rating, past map[int64]*model.Past, params *model.RatingParameter)

Copy copy data from month to month

func (*Service) DelPastRecord

func (s *Service) DelPastRecord(c context.Context, date time.Time) (err error)

DelPastRecord del past record

func (*Service) DelRatings

func (s *Service) DelRatings(c context.Context, date time.Time) (err error)

DelRatings del ratings

func (*Service) DelTrends

func (s *Service) DelTrends(c context.Context, table string) (err error)

DelTrends del trends

func (*Service) InsertPastRecord

func (s *Service) InsertPastRecord(c context.Context, date string) (err error)

InsertPastRecord insert past record

func (*Service) InsertTaskStatus

func (s *Service) InsertTaskStatus(c context.Context, ctype, status int, date, message string) (err error)

InsertTaskStatus insert task status

func (*Service) Ping

func (s *Service) Ping(c context.Context) (err error)

Ping check dao health.

func (*Service) PrepareData

func (s *Service) PrepareData(c context.Context, date time.Time, past map[int64]*model.Past, params *model.RatingParameter) (err error)

PrepareData prepare old data

func (*Service) RatingFast

func (s *Service) RatingFast(c context.Context, date time.Time, start, end int, ch chan []*model.Rating) (err error)

RatingFast close chan when part finished

func (*Service) RatingInfos

func (s *Service) RatingInfos(c context.Context, date time.Time, ch chan []*model.Rating) (err error)

RatingInfos rating infos

func (*Service) RatingOffEnd

func (s *Service) RatingOffEnd(c context.Context, date time.Time) (offset, end, count int, err error)

RatingOffEnd get offset and end

func (*Service) Ratings

func (s *Service) Ratings(c context.Context, date time.Time, start, end int, ch chan []*model.Rating) (err error)

Ratings chan <- ratings, close chan outside

func (*Service) Run

func (s *Service) Run(c context.Context, date time.Time) (err error)

Run run scores

func (*Service) RunPastScore

func (s *Service) RunPastScore(c context.Context, date time.Time) (err error)

RunPastScore run past score by date

func (*Service) RunStatistics

func (s *Service) RunStatistics(c context.Context, date time.Time) (err error)

RunStatistics run up rating statistics

Jump to

Keyboard shortcuts

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