database

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 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 DB

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

func New

func New(dbPath string) (*DB, error)

New creates a new database connection

func (*DB) Close

func (db *DB) Close() error

Close closes the database connection

func (*DB) DeleteOldDevices

func (db *DB) DeleteOldDevices(olderThan time.Duration) error

DeleteOldDevices removes devices not seen for the specified duration

func (*DB) GetDeviceCount

func (db *DB) GetDeviceCount() (int, error)

GetDeviceCount returns the total number of devices in the database

func (*DB) GetSSHDeviceCount

func (db *DB) GetSSHDeviceCount() (int, error)

GetSSHDeviceCount returns the number of devices with SSH enabled

func (*DB) LoadDevices

func (db *DB) LoadDevices() ([]scanner.Device, error)

LoadDevices loads all devices from the database

func (*DB) LoadRecentDevices

func (db *DB) LoadRecentDevices(since time.Duration) ([]scanner.Device, error)

LoadRecentDevices loads devices seen within the last specified duration

func (*DB) LoadSetting

func (db *DB) LoadSetting(key string) (string, error)

LoadSetting loads an application setting

func (*DB) SaveDevice

func (db *DB) SaveDevice(device scanner.Device) error

SaveDevice saves or updates a device in the database

func (*DB) SaveDevices

func (db *DB) SaveDevices(devices []scanner.Device) error

SaveDevices saves multiple devices in a transaction

func (*DB) SaveSetting

func (db *DB) SaveSetting(key, value string) error

SaveSetting saves an application setting

func (*DB) UpdateDeviceConnection

func (db *DB) UpdateDeviceConnection(ip string, connected bool) error

UpdateDeviceConnection updates only the connection status of a device

func (*DB) UpdateDeviceCredentials

func (db *DB) UpdateDeviceCredentials(ip, username, password string) error

UpdateDeviceCredentials updates username and password for a device

Jump to

Keyboard shortcuts

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