datastore

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: 3 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoResults = sqlstore.ErrNoResults // ???

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

Functions

This section is empty.

Types

type Datastore

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

func New(c *sqlstore.Config) Datastore

New instantiates a new datastore from the given configuration struct

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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