analytics

package
v0.0.0-...-5ccde39 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Count the number of distinct IP addresses which have visited the host & path.
	QueryVisitorsPerHostPath = `SELECT COUNT(distinct ip) FROM visits WHERE host = ? AND path = ?;`
	// Count the number of entries with the given host & path.
	QueryVisitsPerHostPath = `SELECT COUNT(id) FROM visits WHERE host = ? AND path = ?;`

	// List all the distinct paths in the database.
	QueryAllPaths = `SELECT DISTINCT path FROM visits;`
	// List all the distinct hosts in the database.
	QueryAllHosts = `SELECT DISTINCT host FROM visits;`
)

Variables

This section is empty.

Functions

func AllHosts

func AllHosts(db *sqlx.DB) (hosts []string, err error)

Fetch all the hosts in the database.

func AllPaths

func AllPaths(db *sqlx.DB) (paths []string, err error)

Fetch all the paths in the database.

func ListDistinctColumn

func ListDistinctColumn(db *sqlx.DB, col string) (entries []string, err error)

Fetch the distinct entries of an arbitrary column in the database.

func ViewsForHostPath

func ViewsForHostPath(db *sqlx.DB, host string, path string) (count int, err error)

Fetch a count of all the views of the path.

func VisitorsForHostPath

func VisitorsForHostPath(db *sqlx.DB, host string, path string) (count int, err error)

Fetch a count of all the visitors for the given path. This is done by counting the distinct IP addresses which have visited the path.

Types

This section is empty.

Jump to

Keyboard shortcuts

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