fathom: github.com/usefathom/fathom/pkg/datastore Index | Files | Directories

package datastore

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

Index

Package Files

datastore.go

Variables

var ErrNoResults = sqlstore.ErrNoResults // ???

ErrNoResults is returned whenever a single-item query returns 0 results

type Datastore Uses

type Datastore interface {
    // users
    GetUser(int64) (*models.User, error)
    GetUserByEmail(string) (*models.User, error)
    SaveUser(*models.User) error
    DeleteUser(*models.User) error
    CountUsers() (int64, error)

    // sites
    GetSites() ([]*models.Site, error)
    GetSite(id int64) (*models.Site, error)
    SaveSite(s *models.Site) error
    DeleteSite(s *models.Site) error

    // site stats
    GetSiteStats(int64, time.Time) (*models.SiteStats, error)
    GetAggregatedSiteStats(int64, time.Time, time.Time) (*models.SiteStats, error)
    SelectSiteStats(int64, time.Time, time.Time) ([]*models.SiteStats, error)
    GetRealtimeVisitorCount(int64) (int64, error)
    SaveSiteStats(*models.SiteStats) error

    // pageviews
    InsertPageviews([]*models.Pageview) error
    UpdatePageviews([]*models.Pageview) error
    GetPageview(string) (*models.Pageview, error)
    GetProcessablePageviews(limit int) ([]*models.Pageview, error)
    DeletePageviews([]*models.Pageview) error

    // page stats
    GetPageStats(int64, time.Time, int64, int64) (*models.PageStats, error)
    SavePageStats(*models.PageStats) error
    SelectAggregatedPageStats(int64, time.Time, time.Time, int, int) ([]*models.PageStats, error)
    GetAggregatedPageStatsPageviews(int64, time.Time, time.Time) (int64, error)

    // referrer stats
    GetReferrerStats(int64, time.Time, int64, int64) (*models.ReferrerStats, error)
    SaveReferrerStats(*models.ReferrerStats) error
    SelectAggregatedReferrerStats(int64, time.Time, time.Time, int, int) ([]*models.ReferrerStats, error)
    GetAggregatedReferrerStatsPageviews(int64, time.Time, time.Time) (int64, error)

    // hostnames
    HostnameID(name string) (int64, error)
    PathnameID(name string) (int64, error)

    // misc
    Health() error
    Close() error
}

Datastore represents a database implementations

func New Uses

func New(c *sqlstore.Config) Datastore

New instantiates a new datastore from the given configuration struct

Directories

PathSynopsis
sqlstore

Package datastore imports 3 packages (graph) and is imported by 3 packages. Updated 2019-02-28. Refresh now. Tools for package owners.