database

package
v0.0.0-...-1f035db Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHomeDir

func GetHomeDir() string

Types

type Activity

type Activity struct {
	Start_Time  int64  // timestamp of when session started
	Log_Time    int64  // timestamp of when activity was recorded
	App_Or_Site string // app_title or website domain
	Url         string // website_url
	App_Name    string // app_title
	Title       string // website_title or windowTitle
}

every second, time series log of current application being used needed for alerts and gathering data

func ScanAllRows

func ScanAllRows(rows *sql.Rows) []Activity

Scans the data returned from query to get all rows

type Alert_Settings

type Alert_Settings struct {
	Alert_ID int
	Alert_On bool
	Interval int
}

type App_Count

type App_Count struct {
	App_Name string
	Count    int
}

How often app was used

func ScanAppCountQuery

func ScanAppCountQuery(rows *sql.Rows) []App_Count

Scans the data returned from query and places into struct

type DB

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

func (*DB) AddActivity

func (d *DB) AddActivity(activity Activity)

Logs computer usage into Activity Table of database

func (*DB) AllTimeMostUsedApp

func (d *DB) AllTimeMostUsedApp() []App_Count

func (*DB) Connection

func (d *DB) Connection()

func (*DB) CountAppUsageWithRange

func (d *DB) CountAppUsageWithRange(startTime int64, endTime int64) []App_Count

Finds the number of occurances of an app/site within a time period

func (*DB) CreateTables

func (d *DB) CreateTables()

func (*DB) GetAlertSettings

func (d *DB) GetAlertSettings() (alert_settings Alert_Settings)

func (*DB) HighestUsedApp

func (d *DB) HighestUsedApp(startTime int64, endTime int64) App_Count

func (*DB) InitAlert

func (d *DB) InitAlert()

func (*DB) QueryAppUsageCount

func (d *DB) QueryAppUsageCount(startTime int64, endTime int64) *sql.Rows

Executes the query to get the count of number of app/site within time period

func (*DB) ReadAllRows

func (d *DB) ReadAllRows() []Activity

Executes a query to get back all rows within Activity Table

func (*DB) UpdateAlertInterval

func (d *DB) UpdateAlertInterval(interval int)

func (*DB) UpdateAlertOn

func (d *DB) UpdateAlertOn(turn_on bool)

Jump to

Keyboard shortcuts

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