store

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceStore

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

DeviceStore is a redis implementation of the Store interface

func NewDeviceStore

func NewDeviceStore(conn redis.Conn) *DeviceStore

NewDeviceStore returns a new DeviceStore

func (*DeviceStore) Close

func (s *DeviceStore) Close() error

Close closes the redis connection

func (*DeviceStore) CreateDevice

func (s *DeviceStore) CreateDevice(device client.Device) error

CreateDevice creates a new device in redis

func (*DeviceStore) DeleteDevice

func (s *DeviceStore) DeleteDevice(id string) error

DeleteDevice deletes a device from redis

func (*DeviceStore) GetDevice

func (s *DeviceStore) GetDevice(id string) (client.Device, error)

GetDevice retrieves a device from redis

func (*DeviceStore) GetDeviceTypes

func (s *DeviceStore) GetDeviceTypes() ([]string, error)

GetDeviceTypes retrieves all device types from redis

func (*DeviceStore) GetDevices

func (s *DeviceStore) GetDevices() ([]client.Device, error)

GetDevices retrieves all devices from redis

func (*DeviceStore) GetDevicesByType

func (s *DeviceStore) GetDevicesByType(deviceType string) ([]client.Device, error)

GetDevicesByType retrieves all devices of a given type from redis

type Store

type Store interface {
	CreateDevice(device client.Device) error
	GetDevice(id string) (client.Device, error)
	DeleteDevice(id string) error
	GetDevicesByType(deviceType string) ([]client.Device, error)
	GetDevices() ([]client.Device, error)
	GetDeviceTypes() ([]string, error)
	Close() error
}

Store is an interface for accessing device data that is stored in redis

Jump to

Keyboard shortcuts

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