postgres

package
v0.0.0-...-73fe611 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataStore

type DataStore struct {
	*sql.DB
	// contains filtered or unexported fields
}

DataStore is the postgreSQL implementation of a data store

func OpenDataStore

func OpenDataStore(driver, dataSource string) *DataStore

OpenDataStore returns an open database connection

func (*DataStore) ActionCreate

func (db *DataStore) ActionCreate(act datastore.Action) (int64, error)

ActionCreate log an new action

func (*DataStore) ActionListForDevice

func (db *DataStore) ActionListForDevice(orgID, deviceID string) ([]datastore.Action, error)

ActionListForDevice lists the actions for a device

func (*DataStore) ActionUpdate

func (db *DataStore) ActionUpdate(actionID, status, message string) error

ActionUpdate updates an action record

func (*DataStore) DeviceCreate

func (db *DataStore) DeviceCreate(device datastore.Device) (int64, error)

DeviceCreate adds a new record to device database table, returning the record ID

func (*DataStore) DeviceGet

func (db *DataStore) DeviceGet(deviceID string) (datastore.Device, error)

DeviceGet fetches a device from the database

func (*DataStore) DeviceList

func (db *DataStore) DeviceList(orgID string) ([]datastore.Device, error)

DeviceList fetches the devices for an organization from the database

func (*DataStore) DevicePing

func (db *DataStore) DevicePing(deviceID string, refresh time.Time) error

DevicePing updates the last ping time from a device

func (*DataStore) DeviceSnapDelete

func (db *DataStore) DeviceSnapDelete(id int64) error

DeviceSnapDelete removes a snap for a device

func (*DataStore) DeviceSnapList

func (db *DataStore) DeviceSnapList(deviceID int64) ([]datastore.DeviceSnap, error)

DeviceSnapList lists the snaps for a device

func (*DataStore) DeviceSnapUpsert

func (db *DataStore) DeviceSnapUpsert(ds datastore.DeviceSnap) error

DeviceSnapUpsert creates or updates a device snap record

func (*DataStore) DeviceVersionDelete

func (db *DataStore) DeviceVersionDelete(id int64) error

DeviceVersionDelete removes a device version

func (*DataStore) DeviceVersionGet

func (db *DataStore) DeviceVersionGet(deviceID int64) (datastore.DeviceVersion, error)

DeviceVersionGet fetches a device version details from the database

func (*DataStore) DeviceVersionUpsert

func (db *DataStore) DeviceVersionUpsert(dv datastore.DeviceVersion) error

DeviceVersionUpsert creates or updates a device version record

func (*DataStore) GroupCreate

func (db *DataStore) GroupCreate(orgID, name string) (int64, error)

GroupCreate creates a new group for an organization

func (*DataStore) GroupGet

func (db *DataStore) GroupGet(orgID, name string) (datastore.Group, error)

GroupGet fetches a group

func (*DataStore) GroupGetDevices

func (db *DataStore) GroupGetDevices(orgID, name string) ([]datastore.Device, error)

GroupGetDevices retrieves the devices for a group

func (*DataStore) GroupGetExcludedDevices

func (db *DataStore) GroupGetExcludedDevices(orgID, name string) ([]datastore.Device, error)

GroupGetExcludedDevices retrieves the devices not in a group

func (*DataStore) GroupLinkDevice

func (db *DataStore) GroupLinkDevice(orgID, name, deviceID string) error

GroupLinkDevice links a device to a group

func (*DataStore) GroupList

func (db *DataStore) GroupList(orgID string) ([]datastore.Group, error)

GroupList lists the groups for an organization

func (*DataStore) GroupUnlinkDevice

func (db *DataStore) GroupUnlinkDevice(orgID, name, deviceID string) error

GroupUnlinkDevice unlinks a device from a group

Jump to

Keyboard shortcuts

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