models

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AliasKind

type AliasKind int

AliasKind represents a kind of alias

const (
	KindShort AliasKind = iota
	KindRandom
)

All kinds of aliases

type Redir

type Redir struct {
	ID        string    `json:"-"          bson:"_id"`
	Alias     string    `json:"alias"      bson:"alias"`
	Kind      AliasKind `json:"kind"       bson:"kind"`
	URL       string    `json:"url"        bson:"url"`
	Private   bool      `json:"private"    bson:"private"`
	ValidFrom time.Time `json:"valid_from" bson:"valid_from"`
}

Redir is the core redir model, it records a kind of alias and its correlated link.

type RedirIndex

type RedirIndex struct {
	ID        string    `json:"-"          yaml:"-"          bson:"_id"`
	Alias     string    `json:"alias"      yaml:"alias"      bson:"alias"`
	Kind      AliasKind `json:"kind"       yaml:"-"       bson:"kind"`
	URL       string    `json:"url"        yaml:"url"        bson:"url"`
	Private   bool      `json:"private"    yaml:"private"    bson:"private"`
	ValidFrom time.Time `json:"valid_from" yaml:"valid_from" bson:"valid_from"`
	UV        int64     `json:"uv"         yaml:"uv"         bson:"uv"`
	PV        int64     `json:"pv"         yaml:"pv"         bson:"pv"`
}

RedirIndex is an extension to Redir, which offers more statistic information such as PV/UV.

type RefStat

type RefStat struct {
	Referer string `json:"referer" bson:"referer"`
	Count   int64  `json:"count"   bson:"count"`
}

Referrer statistic

type TimeHist

type TimeHist struct {
	Time time.Time `bson:"time" json:"time"`
	PV   int       `bson:"pv"   json:"pv"`
	UV   int       `bson:"uv"   json:"uv"`
}

TimeHist statistics

type UAStat

type UAStat struct {
	UA    string `json:"ua"    bson:"ua"`
	Count int64  `json:"count" bson:"count"`
}

UAStat statistics

type Visit

type Visit struct {
	VisitorID string    `json:"visitor_id" bson:"visitor_id"`
	Alias     string    `json:"alias"      bson:"alias"`
	Kind      AliasKind `json:"kind"       bson:"kind"`
	IP        string    `json:"ip"         bson:"ip"`
	UA        string    `json:"ua"         bson:"ua"`
	Referer   string    `json:"referer"    bson:"referer"`
	Time      time.Time `json:"time"       bson:"time"`
}

Visit indicates an record of visit pattern.

type VisitRecord

type VisitRecord struct {
	Alias string `json:"alias" bson:"alias"`
	UV    int64  `json:"uv"    bson:"uv"`
	PV    int64  `json:"pv"    bson:"pv"`
}

VisitRecord represents the visit record of an alias. The record does not contain time range so that the user of this struct can customize it.

Jump to

Keyboard shortcuts

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