db

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBTIMEOUT = 10
	CAPACITY  = 200000

	DAILY    = 0
	MONTHLY  = 1
	RECOVERY = 2
	REFRESH  = 3
	TRACK    = 4
)

DB Constants

Variables

This section is empty.

Functions

func AddNewApp

func AddNewApp(ctx context.Context, element *App, col *mongo.Collection) error

func Flush

func Flush(ctx context.Context, col *mongo.Collection) error

func GetJobParams

func GetJobParams(cfg *config.Config, jobType int) (int, *mongo.Cursor, error)

func SetTrackFlag

func SetTrackFlag(ctx context.Context, id primitive.ObjectID, val bool, col *mongo.Collection) error

func UpdateApp

func UpdateApp(ctx context.Context, app *App, col *mongo.Collection) error

Types

type App

type App struct {
	ID           primitive.ObjectID `bson:"_id,omitempty"`
	Metrics      []Metric           `bson:"metrics"`
	DailyMetrics []DailyMetric      `bson:"daily_metrics"`
	StaticData   StaticAppData      `bson:"static_data"`
	Tracked      bool               `bson:"tracked"`
	LastMetric   DailyMetric        `bson:"last_metric"`
}

type DailyMetric

type DailyMetric struct {
	Date        time.Time `bson:"date"`
	PlayerCount int       `bson:"player_count"`
}

DailyMetric - Metric obj

type Metric

type Metric struct {
	Date        time.Time `bson:"date"`
	AvgPlayers  int       `bson:"avgplayers"`
	Gain        string    `bson:"gain"`
	GainPercent string    `bson:"gainpercent"`
	Peak        int       `bson:"peak"`
}

Metric element

type StaticAppData

type StaticAppData struct {
	Name   string `bson:"name"`
	AppID  int    `bson:"app_id"`
	Domain string `bson:"domain"`
}

func GetFullStaticData

func GetFullStaticData(ctx context.Context, col *mongo.Collection) ([]StaticAppData, error)

Jump to

Keyboard shortcuts

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