storage

package
v0.0.0-...-9e99f10 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClickHouseStorage

type ClickHouseStorage struct {
	// contains filtered or unexported fields
}

func NewClickHouseStorage

func NewClickHouseStorage(dsn string) (*ClickHouseStorage, error)

func (*ClickHouseStorage) Close

func (s *ClickHouseStorage) Close() error

func (*ClickHouseStorage) GetDeviceStats

func (s *ClickHouseStorage) GetDeviceStats(siteID uuid.UUID) ([]DeviceStats, error)

func (*ClickHouseStorage) GetPageViews

func (s *ClickHouseStorage) GetPageViews(siteID uuid.UUID) (int, error)

func (*ClickHouseStorage) GetSiteEventData

func (s *ClickHouseStorage) GetSiteEventData(siteID uuid.UUID) ([]EventData, error)

func (*ClickHouseStorage) GetTopPages

func (s *ClickHouseStorage) GetTopPages(siteID uuid.UUID, limit int) ([]PageStats, error)

func (*ClickHouseStorage) GetTopReferrers

func (s *ClickHouseStorage) GetTopReferrers(siteID uuid.UUID, limit int) ([]ReferrerStats, error)

func (*ClickHouseStorage) GetUniqueVisitors

func (s *ClickHouseStorage) GetUniqueVisitors(siteID uuid.UUID) (int, error)

func (*ClickHouseStorage) GetVisitorGraph

func (s *ClickHouseStorage) GetVisitorGraph(siteID uuid.UUID, startDate, endDate string) ([]VisitorStats, error)

type DeviceStats

type DeviceStats struct {
	DeviceType string `json:"device_type"`
	Count      int    `json:"count"`
}

type EventData

type EventData struct {
	VisitorIP        string
	VisitorUserAgent string
	SiteID           string
	Referrer         string
	Page             string
}

type PageStats

type PageStats struct {
	Page  string `json:"page"`
	Count int    `json:"count"`
}

type PostgresStorage

type PostgresStorage struct {
	Db *pgxpool.Pool
	// contains filtered or unexported fields
}

func NewPostgresStorage

func NewPostgresStorage(ctx context.Context, dsn string) (*PostgresStorage, error)

func (*PostgresStorage) Close

func (s *PostgresStorage) Close() error

type ReferrerStats

type ReferrerStats struct {
	Referrer string `json:"referrer"`
	Count    int    `json:"count"`
}

type Storage

type Storage interface {
	Close() error
}

type VisitorStats

type VisitorStats struct {
	Day            time.Time `json:"day"`
	UniqueVisitors int       `json:"unique_visitors"`
}

Jump to

Keyboard shortcuts

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