fathom: github.com/usefathom/fathom/pkg/models Index | Files

package models

import "github.com/usefathom/fathom/pkg/models"

Index

Package Files

page_stats.go pageview.go referrer_stats.go site.go site_stats.go user.go

type PageStats Uses

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 Uses

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

type Pageview Uses

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 Uses

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 Uses

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

type Site Uses

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 Uses

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 Uses

func (s *SiteStats) FormattedDuration() string

func (*SiteStats) HandlePageview Uses

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

type User Uses

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

func NewUser Uses

func NewUser(e string, pwd string) User

NewUser creates a new User with the given email and password

func (*User) ComparePassword Uses

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

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

func (*User) SetPassword Uses

func (u *User) SetPassword(pwd string)

SetPassword sets a brcrypt encrypted password from the given plaintext pwd

Package models imports 4 packages (graph) and is imported by 5 packages. Updated 2019-01-08. Refresh now. Tools for package owners.