redis

package
v1.2.2-dev.88 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MULTI     = "MULTI"
	SET       = "SET"
	GET       = "GET"
	EXISTS    = "EXISTS"
	DEL       = "DEL"
	HSET      = "HSET"
	HGET      = "HGET"
	HEXISTS   = "HEXISTS"
	HDEL      = "HDEL"
	SADD      = "SADD"
	SREM      = "SREM"
	ZADD      = "ZADD"
	ZREM      = "ZREM"
	EXEC      = "EXEC"
	ZRANGE    = "ZRANGE"
	ZREVRANGE = "ZREVRANGE"
	MGET      = "MGET"
	ZCARD     = "ZCARD"
	ZCOUNT    = "ZCOUNT"
	UNLINK    = "UNLINK"
)

Redis commmands used in this project Reference: https://redis.io/commands

View Source
const (
	InfiniteMin = "-inf"
	InfiniteMax = "+inf"
)
View Source
const (
	DeviceCollection      = "v2:device"
	DeviceCollectionName  = DeviceCollection + ":" + v2.Name
	DeviceCollectionLabel = DeviceCollection + ":" + v2.Label
)
View Source
const (
	EventsCollection           = "v2:event"
	EventsCollectionCreated    = EventsCollection + ":" + v2.Created
	EventsCollectionPushed     = EventsCollection + ":" + v2.Pushed
	EventsCollectionDeviceName = EventsCollection + ":" + v2.DeviceName
	EventsCollectionReadings   = EventsCollection + ":readings"
)
View Source
const (
	ReadingsCollection           = "v2:reading"
	ReadingsCollectionCreated    = ReadingsCollection + ":" + v2.Created
	ReadingsCollectionDeviceName = ReadingsCollection + ":" + v2.DeviceName
	ReadingsCollectionName       = ReadingsCollection + ":" + v2.Name
)
View Source
const DeviceProfileCollection = "v2:deviceProfile"
View Source
const DeviceServiceCollection = "v2:deviceService"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*redisClient.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config db.Configuration, logger logger.LoggingClient) (*Client, errors.EdgeX)

func (*Client) AddDevice

func (c *Client) AddDevice(d model.Device) (model.Device, errors.EdgeX)

Add a new device

func (*Client) AddDeviceProfile

func (c *Client) AddDeviceProfile(dp model.DeviceProfile) (model.DeviceProfile, errors.EdgeX)

Add a new device profle

func (*Client) AddDeviceService

func (c *Client) AddDeviceService(ds model.DeviceService) (model.DeviceService, errors.EdgeX)

AddDeviceService adds a new device service

func (*Client) AddEvent

func (c *Client) AddEvent(e model.Event) (model.Event, errors.EdgeX)

AddEvent adds a new event

func (*Client) CloseSession

func (c *Client) CloseSession()

CloseSession closes the connections to Redis

func (*Client) DeleteDeviceById

func (c *Client) DeleteDeviceById(id string) errors.EdgeX

DeleteDeviceById deletes a device by id

func (*Client) DeleteDeviceByName

func (c *Client) DeleteDeviceByName(name string) errors.EdgeX

DeleteDeviceByName deletes a device by name

func (*Client) DeleteDeviceProfileById

func (c *Client) DeleteDeviceProfileById(id string) errors.EdgeX

DeleteDeviceProfileById deletes a device profile by id

func (*Client) DeleteDeviceProfileByName

func (c *Client) DeleteDeviceProfileByName(name string) errors.EdgeX

DeleteDeviceProfileByName deletes a device profile by name

func (*Client) DeleteDeviceServiceById

func (c *Client) DeleteDeviceServiceById(id string) errors.EdgeX

DeleteDeviceServiceById deletes a device service by id

func (*Client) DeleteDeviceServiceByName

func (c *Client) DeleteDeviceServiceByName(name string) errors.EdgeX

DeleteDeviceServiceByName deletes a device service by name

func (*Client) DeviceProfileNameExists

func (c *Client) DeviceProfileNameExists(name string) (bool, errors.EdgeX)

DeviceProfileNameExists checks the device profile exists by name

func (*Client) DeviceServiceNameExists

func (c *Client) DeviceServiceNameExists(name string) (bool, errors.EdgeX)

DeviceServiceNameExists checks the device service exists by name

func (*Client) EventById

func (c *Client) EventById(id string) (event model.Event, edgeXerr errors.EdgeX)

EventById gets an event by id

func (*Client) EventCountByDevice

func (c *Client) EventCountByDevice(deviceName string) (uint32, errors.EdgeX)

EventCountByDevice returns the count of Event associated a specific Device from the database

func (*Client) EventTotalCount

func (c *Client) EventTotalCount() (uint32, errors.EdgeX)

EventTotalCount returns the total count of Event from the database

func (*Client) GetDeviceProfileByName

func (c *Client) GetDeviceProfileByName(name string) (deviceProfile model.DeviceProfile, edgeXerr errors.EdgeX)

GetDeviceProfileByName gets a device profile by name

func (*Client) GetDeviceProfiles

func (c *Client) GetDeviceProfiles(offset int, limit int, labels []string) ([]model.DeviceProfile, errors.EdgeX)

GetDeviceProfiles query device profiles with offset and limit

func (*Client) GetDeviceServiceById

func (c *Client) GetDeviceServiceById(id string) (deviceService model.DeviceService, edgeXerr errors.EdgeX)

GetDeviceServiceById gets a device service by id

func (*Client) GetDeviceServiceByName

func (c *Client) GetDeviceServiceByName(name string) (deviceService model.DeviceService, edgeXerr errors.EdgeX)

GetDeviceServiceByName gets a device service by name

func (*Client) GetDeviceServices

func (c *Client) GetDeviceServices(offset int, limit int, labels []string) (deviceServices []model.DeviceService, edgeXerr errors.EdgeX)

GetDeviceServices returns multiple device services per query criteria, including offset: the number of items to skip before starting to collect the result set limit: The numbers of items to return labels: allows for querying a given object by associated user-defined labels

func (*Client) UpdateDeviceProfile

func (c *Client) UpdateDeviceProfile(dp model.DeviceProfile) errors.EdgeX

UpdateDeviceProfile updates a new device profile

func (*Client) UpdateEventPushedById

func (c *Client) UpdateEventPushedById(id string) errors.EdgeX

Update the pushed timestamp of an event

Jump to

Keyboard shortcuts

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