ro2

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupDOmain

func CleanupDOmain(domain string) string

func Reduce added in v1.3.0

func Reduce(metrics []string) func(*Stats, map[string]any)

func StatToValue

func StatToValue(metric string) func(s *Stats) float64

Types

type And

type And []Filter

func (And) Apply

func (a And) Apply(rtx *Tx, shard uint64, view uint64, columns *roaring.Bitmap) *roaring.Bitmap

type DB

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

func (*DB) APIKeys added in v1.1.0

func (db *DB) APIKeys() (ls []*v1.APIKey, err error)

func (*DB) Badger

func (db *DB) Badger() *badger.DB

func (*DB) Close

func (db *DB) Close() error

func (*DB) CreateAPIKey added in v1.1.0

func (db *DB) CreateAPIKey(name string, key string) error

func (*DB) CreateSite

func (db *DB) CreateSite(domain string, public bool) (err error)

func (*DB) DeleteAPIKey added in v1.1.0

func (db *DB) DeleteAPIKey(name string) error

func (*DB) DeleteDomain

func (db *DB) DeleteDomain(domain string) (err error)
func (db *DB) DeleteSharedLink(site *v1.Site, slug string) error

func (*DB) Domains

func (db *DB) Domains(f func(*v1.Site))
func (db *DB) EditSharedLink(site *v1.Site, slug, name string) error
func (db *DB) FindOrCreateCreateSharedLink(domain string, name, password string) (share *v1.Share)

func (*DB) Save

func (db *DB) Save(u *v1.Site) error

func (*DB) SeenFirstStats

func (db *DB) SeenFirstStats(domain string) (ok bool)

func (*DB) SetupDomains added in v1.3.0

func (db *DB) SetupDomains(domains []string)

func (*DB) Site

func (db *DB) Site(domain string) (u *v1.Site)

func (*DB) Start

func (db *DB) Start(ctx context.Context)

func (*DB) Update

func (db *DB) Update(f func(tx *Tx) error) error

func (*DB) ValidAPIKkey added in v1.1.0

func (db *DB) ValidAPIKkey(key string) bool

func (*DB) ValidateSiteDomain

func (db *DB) ValidateSiteDomain(domain string) (good, bad string)

func (*DB) View

func (db *DB) View(f func(tx *Tx) error) error

type Filter

type Filter interface {
	Apply(rtx *Tx, shard uint64, view uint64, columns *roaring.Bitmap) *roaring.Bitmap
}

type Match

type Match struct {
	Field  v1.Field
	Values []int64
	Negate bool
	Op     roaring.Operation
}

func (*Match) Apply

func (m *Match) Apply(rtx *Tx, shard uint64, view uint64, columns *roaring.Bitmap) (b *roaring.Bitmap)

type Reject

type Reject struct{}

func (Reject) Apply

func (Reject) Apply(rtx *Tx, shard uint64, view uint64, columns *roaring.Bitmap) *roaring.Bitmap

type Result

type Result struct {
	Results []map[string]any `json:"results"`
}

type Stats

type Stats struct {
	Visitors,
	Visits,
	PageViews,
	ViewsPerVisits,
	BounceRate,
	VisitDuration float64
	// contains filtered or unexported fields
}

func NewStats

func NewStats(fs fieldset.Set) *Stats

func (*Stats) Compute

func (s *Stats) Compute()

func (*Stats) Read

func (d *Stats) Read(tx *Tx, shard, view uint64, match *roaring.Bitmap, fields fieldset.Set) error

type Store

type Store struct {
	*DB
}

func Open

func Open(path string) (*Store, error)

func (*Store) Breakdown

func (o *Store) Breakdown(domain string, params *query.Query, metrics []string, field v1.Field) (*Result, error)

func (*Store) BreakdownCity

func (o *Store) BreakdownCity(domain string, params *query.Query, metrics []string) (*Result, error)

func (*Store) BreakdownExitPages

func (o *Store) BreakdownExitPages(domain string, params *query.Query) (*Result, error)

func (*Store) BreakdownVisitorsWithPercentage

func (o *Store) BreakdownVisitorsWithPercentage(domain string, params *query.Query, field v1.Field) (*Result, error)

func (*Store) CurrentVisitors

func (o *Store) CurrentVisitors(domain string) (visitors uint64, err error)

func (*Store) Delete

func (s *Store) Delete(_ context.Context, key string) error

func (*Store) Get

func (s *Store) Get(_ context.Context, key string) ([]byte, error)

func (*Store) Put

func (s *Store) Put(_ context.Context, key string, data []byte) error

func (*Store) Stats

func (o *Store) Stats(domain string, start, end time.Time, interval query.Interval, filters query.Filters, metrics []string) (*Stats, error)

func (*Store) Timeseries

func (o *Store) Timeseries(domain string, params *query.Query, metrics []string) (map[string]*Stats, error)

func (*Store) Visitors

func (o *Store) Visitors(domain string) (visitors uint64, err error)

func (*Store) Web

func (o *Store) Web() (secret *age.X25519Identity, err error)

type Tx

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

func (*Tx) Bitmap

func (tx *Tx) Bitmap(shard, view uint64, field v1.Field, f func(bs *roaring.BSI)) error

func (*Tx) Close

func (tx *Tx) Close()

func (*Tx) Count

func (tx *Tx) Count(shard, view uint64, field v1.Field, match *roaring.Bitmap) (count uint64, err error)

func (*Tx) Find

func (tx *Tx) Find(field v1.Field, id uint64) (o string)

func (*Tx) ID

func (tx *Tx) ID(field v1.Field, value []byte) (id uint64, ok bool)

func (*Tx) Iter

func (tx *Tx) Iter() *badger.Iterator

func (*Tx) RecordID

func (tx *Tx) RecordID() uint64

func (*Tx) Release

func (tx *Tx) Release()

func (*Tx) Search

func (tx *Tx) Search(field v1.Field, prefix []byte, f func([]byte, uint64))

func (*Tx) Select

func (tx *Tx) Select(domain string, start,
	end time.Time, intrerval query.Interval, filters query.Filters, cb func(shard, view uint64, columns *roaring.Bitmap) error) error

func (*Tx) Sum

func (tx *Tx) Sum(shard, view uint64, field v1.Field, match *roaring.Bitmap) (sum int64, err error)

func (*Tx) Translate

func (tx *Tx) Translate(field v1.Field, value []byte) (id uint64)

func (*Tx) Transpose

func (tx *Tx) Transpose(shard, view uint64, field v1.Field, match *roaring.Bitmap) (result *roaring.Bitmap, err error)

func (*Tx) TransposeSet

func (tx *Tx) TransposeSet(shard, view uint64, field v1.Field, match *roaring.Bitmap) (result map[int64][]uint64, err error)

func (*Tx) Unique

func (tx *Tx) Unique(shard, view uint64, field v1.Field, match *roaring.Bitmap) (uint64, error)

Jump to

Keyboard shortcuts

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