models

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: MIT Imports: 4 Imported by: 25

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PageStats

type PageStats struct {
	New            bool      `db:"-" json:"-"`
	SiteID         int64     `db:"site_id" json:"-"`
	HostnameID     int64     `db:"hostname_id" json:"-"`
	PathnameID     int64     `db:"pathname_id" json:"-"`
	Hostname       string    `db:"hostname"`
	Pathname       string    `db:"pathname"`
	Pageviews      int64     `db:"pageviews"`
	Visitors       int64     `db:"visitors"`
	Entries        int64     `db:"entries"`
	BounceRate     float64   `db:"bounce_rate"`
	AvgDuration    float64   `db:"avg_duration"`
	KnownDurations int64     `db:"known_durations"`
	Date           time.Time `db:"ts" json:",omitempty"`
}

func (*PageStats) HandlePageview

func (s *PageStats) HandlePageview(p *Pageview)

type Pageview

type Pageview struct {
	ID             string    `db:"id"`
	SiteTrackingID string    `db:"site_tracking_id"`
	Hostname       string    `db:"hostname"`
	Pathname       string    `db:"pathname"`
	IsNewVisitor   bool      `db:"is_new_visitor"`
	IsNewSession   bool      `db:"is_new_session"`
	IsUnique       bool      `db:"is_unique"`
	IsBounce       bool      `db:"is_bounce"`
	IsFinished     bool      `db:"is_finished"`
	Referrer       string    `db:"referrer"`
	Duration       int64     `db:"duration"`
	Timestamp      time.Time `db:"timestamp"`
}

type ReferrerStats

type ReferrerStats struct {
	New            bool      `db:"-" json:"-"`
	SiteID         int64     `db:"site_id" json:"-"`
	HostnameID     int64     `db:"hostname_id" json:"-"`
	PathnameID     int64     `db:"pathname_id" json:"-"`
	Hostname       string    `db:"hostname"`
	Pathname       string    `db:"pathname"`
	Group          string    `db:"groupname"`
	Visitors       int64     `db:"visitors"`
	Pageviews      int64     `db:"pageviews"`
	BounceRate     float64   `db:"bounce_rate"`
	AvgDuration    float64   `db:"avg_duration"`
	KnownDurations int64     `db:"known_durations"`
	Date           time.Time `db:"ts" json:",omitempty"`
}

func (*ReferrerStats) HandlePageview

func (s *ReferrerStats) HandlePageview(p *Pageview)

type Site

type Site struct {
	ID         int64  `db:"id" json:"id"`
	TrackingID string `db:"tracking_id" json:"trackingId"`
	Name       string `db:"name" json:"name"`
}

Site represents a group for tracking data

type SiteStats

type SiteStats struct {
	New            bool      `db:"-" json:"-" `
	SiteID         int64     `db:"site_id" json:"-"`
	Visitors       int64     `db:"visitors"`
	Pageviews      int64     `db:"pageviews"`
	Sessions       int64     `db:"sessions"`
	BounceRate     float64   `db:"bounce_rate"`
	AvgDuration    float64   `db:"avg_duration"`
	KnownDurations int64     `db:"known_durations" json:",omitempty"`
	Date           time.Time `db:"ts" json:",omitempty"`
}

func (*SiteStats) FormattedDuration

func (s *SiteStats) FormattedDuration() string

func (*SiteStats) HandlePageview

func (s *SiteStats) HandlePageview(p *Pageview)

type User

type User struct {
	ID       int64
	Email    string
	Password string `json:"-"`
}

func NewUser

func NewUser(e string, pwd string) User

NewUser creates a new User with the given email and password

func (*User) ComparePassword

func (u *User) ComparePassword(pwd string) error

ComparePassword returns true when the given plaintext password matches the encrypted pwd

func (*User) SetPassword

func (u *User) SetPassword(pwd string)

SetPassword sets a brcrypt encrypted password from the given plaintext pwd

Jump to

Keyboard shortcuts

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