metric

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DailyReport

type DailyReport struct {
	Date     time.Time `json:"date"`
	HitCount int64     `json:"count"`
}

DailyReport contain sumary of daily hit

type MismatchReport

type MismatchReport struct {
	URL       string    `json:"url"`
	Count     int64     `json:"count"`
	FirstSeen time.Time `json:"first_seen"`
	LastSeen  time.Time `json:"last_seen"`
}

MismatchReport contain sumary of total count of not-matching rule

type ReportRepo

type ReportRepo interface {
	MismatchReports(ctx context.Context, paginationParam repository.PaginationParam) (list []*MismatchReport, err error)
	DailyReports(ctx context.Context, startDate, endDate, ruleID string) (list []*DailyReport, err error)

	CountMatched(ctx context.Context, whereParams url.Values) (count int64, err error)
	CountUniquePage(ctx context.Context, whereParams url.Values) (count int64, err error)
}

ReportRepo responsble to generate report [mock]

func NewReportRepo

func NewReportRepo(impl ReportRepoImpl) ReportRepo

NewReportRepo return new instance of MetricsRuleMatchingRepo [constructor]

type ReportRepoImpl

type ReportRepoImpl struct {
	dig.In
	*typpostgres.DB
}

ReportRepoImpl is implementation of ReportRepo

func (*ReportRepoImpl) CountMatched

func (r *ReportRepoImpl) CountMatched(ctx context.Context, whereParams url.Values) (count int64, err error)

CountMatched is count matched

func (*ReportRepoImpl) CountUniquePage

func (r *ReportRepoImpl) CountUniquePage(ctx context.Context, whereParams url.Values) (count int64, err error)

CountUniquePage is count unique page

func (*ReportRepoImpl) DailyReports

func (r *ReportRepoImpl) DailyReports(ctx context.Context, startDate, endDate, ruleID string) (list []*DailyReport, err error)

DailyReports return list of daily report

func (*ReportRepoImpl) MismatchReports

func (r *ReportRepoImpl) MismatchReports(ctx context.Context, paginationParam repository.PaginationParam) (list []*MismatchReport, err error)

MismatchReports return list of not-matching report

type RuleMatching

type RuleMatching struct {
	Time      time.Time
	IsMatched int
	RuleID    *int64
	URL       *string
}

RuleMatching represented metrics_rule_matching entity

type RuleMatchingRepo

type RuleMatchingRepo interface {
	Insert(context.Context, RuleMatching) (err error)
}

RuleMatchingRepo to handle metrics_rule_matching entity [mock]

func NewRuleMatchingRepo

func NewRuleMatchingRepo(impl RuleMatchingRepoImpl) RuleMatchingRepo

NewRuleMatchingRepo return new instance of MetricsRuleMatchingRepo [constructor]

type RuleMatchingRepoImpl

type RuleMatchingRepoImpl struct {
	dig.In
	*typpostgres.DB
}

RuleMatchingRepoImpl is implementation metrics_rule_matching repository

func (*RuleMatchingRepoImpl) Insert

func (r *RuleMatchingRepoImpl) Insert(ctx context.Context, e RuleMatching) (err error)

Insert metrics_rule_matching

Jump to

Keyboard shortcuts

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