statistic

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package statistic present full API functionality of the specific object

Package statistic present full API functionality of the specific object

Index

Constants

View Source
const (
	RBACStatisticObjectName = `statistic`
)

Variables

View Source
var (
	RBACStatisticObject = acl.RBACType{
		ResourceName: RBACStatisticObjectName,
	}
)

Functions

func IsAggregationKey added in v0.2.0

func IsAggregationKey(key string) bool

IsAggregationKey checks if the key is an aggregation key. Aggregation keys are used for grouping and aggregating statistics.

func WithGroup

func WithGroup(fields ...Key) *repository.GroupOption

Types

type Condition

type Condition struct {
	Key   Key
	Op    Operation
	Value []any
}

func (*Condition) PrepareQuery

func (cond *Condition) PrepareQuery(query *gorm.DB) *gorm.DB

type Filter

type Filter struct {
	Conditions []*Condition
	StartDate  time.Time
	EndDate    time.Time
}

Filter of the objects list

func (*Filter) PrepareQuery

func (fl *Filter) PrepareQuery(query *gorm.DB) *gorm.DB

type Key

type Key string
const (
	KeyUndefined    Key = "undefined"
	KeyDatemark     Key = "datemark"
	KeyTimemark     Key = "timemark"
	KeySourceID     Key = "source_id"
	KeyPlatformType Key = "platform_type"
	KeyDomain       Key = "domain"
	KeyAppID        Key = "app_id"
	KeyZoneID       Key = "zone_id"
	KeyFormatID     Key = "format_id"
	KeyFormatCode   Key = "format_code"
	KeyCarrierID    Key = "carrier_id"
	KeyCountry      Key = "country"
	KeyLanguage     Key = "language"
	KeyIP           Key = "ip"
	KeyDeviceID     Key = "device_id"
	KeyDeviceType   Key = "device_type"
	KeyOsID         Key = "os_id"
	KeyBrowserID    Key = "browser_id"
)

func (Key) String

func (key Key) String() string

type ListOrder

type ListOrder struct {
	Orders map[OrderingKey]models.Order
}

ListOrder of the objects list

func (*ListOrder) PrepareQuery

func (ol *ListOrder) PrepareQuery(query *gorm.DB) *gorm.DB

func (*ListOrder) SetOrder added in v0.2.0

func (ol *ListOrder) SetOrder(key OrderingKey, order models.Order)

type Operation

type Operation int32
const (
	ConditionUndefined Operation = iota
	ConditionEq
	ConditionNotEq
	ConditionGt
	ConditionGtEq
	ConditionLt
	ConditionLtEq
	ConditionIn
	ConditionNotIn
	ConditionBetween
	ConditionNotBetween
	ConditionLike
	ConditionNotLike
	ConditionIsNull
	ConditionIsNotNull
)

type Option

type Option = repository.QOption

List select options

type Options

type Options = repository.ListOptions

List select options

type OrderingKey added in v0.2.0

type OrderingKey string
const (
	OrderingUndefined       OrderingKey = "undefined"
	OrderingKeyDatemark     OrderingKey = "datemark"
	OrderingKeyTimemark     OrderingKey = "timemark"
	OrderingKeySourceID     OrderingKey = "source_id"
	OrderingKeyPlatformType OrderingKey = "platform_type"
	OrderingKeyDomain       OrderingKey = "domain"
	OrderingKeyAppID        OrderingKey = "app_id"
	OrderingKeyZoneID       OrderingKey = "zone_id"
	OrderingKeyFormatID     OrderingKey = "format_id"
	OrderingKeyFormatCode   OrderingKey = "format_code"
	OrderingKeyCarrierID    OrderingKey = "carrier_id"
	OrderingKeyCountry      OrderingKey = "country"
	OrderingKeyLanguage     OrderingKey = "language"
	OrderingKeyIP           OrderingKey = "ip"
	OrderingKeyDeviceID     OrderingKey = "device_id"
	OrderingKeyDeviceType   OrderingKey = "device_type"
	OrderingKeyOsID         OrderingKey = "os_id"
	OrderingKeyBrowserID    OrderingKey = "browser_id"
	// Counters
	OrderingKeyRequests OrderingKey = "imps+views+directs+clicks"
	OrderingKeyImps     OrderingKey = "imps"
	OrderingKeyViews    OrderingKey = "views"
	OrderingKeyDirects  OrderingKey = "directs"
	OrderingKeyClicks   OrderingKey = "clicks"
	OrderingKeyBids     OrderingKey = "bid_requests"
	OrderingKeyWins     OrderingKey = "bid_wins"
	OrderingKeySkips    OrderingKey = "bid_skips"
	OrderingKeyNobids   OrderingKey = "bid_nobids"
	OrderingKeyErrors   OrderingKey = "bid_errors"
	OrderingKeyRevenue  OrderingKey = "revenue"
	OrderingKeyBidPrice OrderingKey = "potential_revenue"
	OrderingKeyCTR      OrderingKey = "IF(imps > 0, (clicks / imps) * 100, 0)"
	OrderingKeyECPM     OrderingKey = "IF(imps > 0, (revenue / imps) * 1000, 0)"
	OrderingKeyECPC     OrderingKey = "IF(clicks > 0, (revenue / clicks), 0)"
)

func (OrderingKey) String added in v0.2.0

func (key OrderingKey) String() string

type Repository

type Repository interface {
	Statistic(ctx context.Context, opts ...Option) ([]*models.StatisticAdItem, error)
	Count(ctx context.Context, opts ...Option) (int64, error)
}

Repository of access to the statistic

type StatisticAdItem added in v0.2.0

type StatisticAdItem = models.StatisticAdItem

type StatisticAdItemKey added in v0.2.0

type StatisticAdItemKey = models.StatisticAdItemKey

type Usecase

type Usecase interface {
	Statistic(ctx context.Context, opts ...Option) ([]*models.StatisticAdItem, error)
	Count(ctx context.Context, opts ...Option) (int64, error)
}

Usecase of access to the statistic

Directories

Path Synopsis
delivery

Jump to

Keyboard shortcuts

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