clientdevices

package
v0.0.0-...-19309d3 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientDevices

type ClientDevices interface {
	AddDevice(newDevice Device) error
	UpdateDevice(device Device) error
	FindDeviceByName(name string) (Device, error)
	RemoveDeviceByName(name string) error
	GetAllDevices() (Devices, error)
}

ClientDevice interface to interacting with IoT Devices

func NewSqlLiteClient

func NewSqlLiteClient(options SqlLiteOptions) (ClientDevices, error)

NewClient will initialize the Database and return the client

type Device

type Device struct {
	Name     string `json:"name"`
	Platform string `json:"platform"`
	Mac      string `json:"mac_address"`
	Ip       string `json:"ip_address"`
}

Device represents a single IoT Device or Asset in the field

func JsonReq2Device

func JsonReq2Device(req *http.Request) (Device, error)

type Devices

type Devices []Device

Devices - a list of multiple devices

type SqlLiteDevices

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

SqlLiteDevicesLib implements the ClientDevice interface

func (*SqlLiteDevices) AddDevice

func (s *SqlLiteDevices) AddDevice(newDevice Device) error

AddDevice - Insert into table

func (*SqlLiteDevices) FindDeviceByName

func (s *SqlLiteDevices) FindDeviceByName(device_name string) (Device, error)

FindDeviceByName - find a device by its nickname

func (*SqlLiteDevices) GetAllDevices

func (s *SqlLiteDevices) GetAllDevices() (Devices, error)

GetAllDevices - get all registered devices

func (*SqlLiteDevices) RemoveDeviceByName

func (s *SqlLiteDevices) RemoveDeviceByName(device_name string) error

RemoveDeviceByName - remove device given its nickname

func (*SqlLiteDevices) UpdateDevice

func (s *SqlLiteDevices) UpdateDevice(device Device) error

UpdateDevice - update information on a specific device

type SqlLiteOptions

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

func NewSqlLiteDefaultOptions

func NewSqlLiteDefaultOptions() SqlLiteOptions

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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