database

package
v1.5.1-0...-2a0d9a0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDatabase

func CheckDatabase(databasePath string)

CheckDatabase checks the SQLite database file at the given path.

Parameters: - databasePath: a string variable that holds the path to the SQLite database file.

Returns: None.

func GetCpuPercent

func GetCpuPercent() float64

func Savetodb

func Savetodb(databasePath string, dev []config.Dev, tokens map[int]string, maxsaved int)

Savetodb saves device statistics to the database.

Parameters: - databasePath: the path to the database. - dev: an array of device configurations. - tokens: a map of token IDs to strings. - maxsaved: the maximum number of records to delete.

Types

type Dev

type Dev struct {
	Password string `json:"password"`
	Key      string `json:"key"`
	IP       string `json:"ip"`
}

type DeviceInfo

type DeviceInfo struct {
	DevName          string `json:"devname"`
	DownloadTotal    int    `json:"download,string"`
	DownSpeed        int    `json:"downspeed,string"`
	Mac              string `json:"mac"`
	MaxDownloadSpeed int    `json:"maxdownloadspeed,string"`
	MaxUploadSpeed   int    `json:"maxuploadspeed,string"`
	Online           int    `json:"online,string"`
	UploadTotal      int    `json:"upload,string"`
	UpSpeed          int    `json:"upspeed,string"`
}

type DevicesHistory

type DevicesHistory struct {
	gorm.Model
	Mac       string
	UpSpeed   int
	DownSpeed int
	UpTotal   int
	DownTotal int
}

func GetDeviceHistory

func GetDeviceHistory(databasePath string, deviceMac string, fixupfloat bool) []DevicesHistory

type RouterHistory

type RouterHistory struct {
	gorm.Model
	Ip        string
	RouterNum int
	Cpu       int
	Cpu_tp    int
	Mem       int
	UpSpeed   int
	DownSpeed int
	UpTotal   int
	DownTotal int
	DeviceNum int
}

For database

func GetRouterHistory

func GetRouterHistory(databasePath string, routernum int, fixupfloat bool) []RouterHistory

Jump to

Keyboard shortcuts

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