Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) AddDevice(d model.Device) (model.Device, errors.EdgeX)
- func (c *Client) AddDeviceProfile(dp model.DeviceProfile) (model.DeviceProfile, errors.EdgeX)
- func (c *Client) AddDeviceService(ds model.DeviceService) (model.DeviceService, errors.EdgeX)
- func (c *Client) AddEvent(e model.Event) (model.Event, errors.EdgeX)
- func (c *Client) AllDeviceProfiles(offset int, limit int, labels []string) ([]model.DeviceProfile, errors.EdgeX)
- func (c *Client) AllDeviceServices(offset int, limit int, labels []string) (deviceServices []model.DeviceService, edgeXerr errors.EdgeX)
- func (c *Client) AllDevices(offset int, limit int, labels []string) ([]model.Device, errors.EdgeX)
- func (c *Client) AllEvents(offset int, limit int) ([]model.Event, errors.EdgeX)
- func (c *Client) CloseSession()
- func (c *Client) DeleteDeviceById(id string) errors.EdgeX
- func (c *Client) DeleteDeviceByName(name string) errors.EdgeX
- func (c *Client) DeleteDeviceProfileById(id string) errors.EdgeX
- func (c *Client) DeleteDeviceProfileByName(name string) errors.EdgeX
- func (c *Client) DeleteDeviceServiceById(id string) errors.EdgeX
- func (c *Client) DeleteDeviceServiceByName(name string) errors.EdgeX
- func (c *Client) DeleteEventById(id string) (edgeXerr errors.EdgeX)
- func (c *Client) DeleteEventsByDeviceName(deviceName string) (edgeXerr errors.EdgeX)
- func (c *Client) DeletePushedEvents() (edgeXerr errors.EdgeX)
- func (c *Client) DeviceById(id string) (device model.Device, edgeXerr errors.EdgeX)
- func (c *Client) DeviceByName(name string) (device model.Device, edgeXerr errors.EdgeX)
- func (c *Client) DeviceIdExists(id string) (bool, errors.EdgeX)
- func (c *Client) DeviceNameExists(name string) (bool, errors.EdgeX)
- func (c *Client) DeviceProfileByName(name string) (deviceProfile model.DeviceProfile, edgeXerr errors.EdgeX)
- func (c *Client) DeviceProfileNameExists(name string) (bool, errors.EdgeX)
- func (c *Client) DeviceServiceById(id string) (deviceService model.DeviceService, edgeXerr errors.EdgeX)
- func (c *Client) DeviceServiceByName(name string) (deviceService model.DeviceService, edgeXerr errors.EdgeX)
- func (c *Client) DeviceServiceNameExists(name string) (bool, errors.EdgeX)
- func (c *Client) DevicesByServiceName(offset int, limit int, name string) (devices []model.Device, edgeXerr errors.EdgeX)
- func (c *Client) EventById(id string) (event model.Event, edgeXerr errors.EdgeX)
- func (c *Client) EventCountByDevice(deviceName string) (uint32, errors.EdgeX)
- func (c *Client) EventTotalCount() (uint32, errors.EdgeX)
- func (c *Client) EventsByDeviceName(offset int, limit int, name string) (events []model.Event, edgeXerr errors.EdgeX)
- func (c *Client) EventsByTimeRange(start int, end int, offset int, limit int) (events []model.Event, edgeXerr errors.EdgeX)
- func (c *Client) UpdateDeviceProfile(dp model.DeviceProfile) errors.EdgeX
- func (c *Client) UpdateEventPushedById(id string) errors.EdgeX
Constants ¶
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" ZRANGEBYSCORE = "ZRANGEBYSCORE" ZREVRANGEBYSCORE = "ZREVRANGEBYSCORE" LIMIT = "LIMIT" )
Redis commmands used in this project Reference: https://redis.io/commands
const ( InfiniteMin = "-inf" InfiniteMax = "+inf" GreaterThanZero = "(0" )
const ( DeviceCollection = "v2:device" DeviceCollectionName = DeviceCollection + ":" + v2.Name DeviceCollectionLabel = DeviceCollection + ":" + v2.Label DeviceCollectionServiceName = DeviceCollection + ":" + v2.Service + ":" + v2.Name )
const ( EventsCollection = "v2:event" EventsCollectionCreated = EventsCollection + ":" + v2.Created EventsCollectionPushed = EventsCollection + ":" + v2.Pushed EventsCollectionDeviceName = EventsCollection + ":" + v2.Device + ":" + v2.Name EventsCollectionReadings = EventsCollection + ":readings" )
const ( ReadingsCollection = "v2:reading" ReadingsCollectionCreated = ReadingsCollection + ":" + v2.Created ReadingsCollectionDeviceName = ReadingsCollection + ":" + v2.Device + ":" + v2.Name ReadingsCollectionName = ReadingsCollection + ":" + v2.Name )
const DeviceProfileCollection = "v2:deviceProfile"
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) 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) AllDeviceProfiles ¶
func (c *Client) AllDeviceProfiles(offset int, limit int, labels []string) ([]model.DeviceProfile, errors.EdgeX)
AllDeviceProfiles query device profiles with offset and limit
func (*Client) AllDeviceServices ¶
func (c *Client) AllDeviceServices(offset int, limit int, labels []string) (deviceServices []model.DeviceService, edgeXerr errors.EdgeX)
AllDeviceServices 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) AllDevices ¶
AllDevices query the devices with offset, limit, and labels
func (*Client) CloseSession ¶
func (c *Client) CloseSession()
CloseSession closes the connections to Redis
func (*Client) DeleteDeviceById ¶
DeleteDeviceById deletes a device by id
func (*Client) DeleteDeviceByName ¶
DeleteDeviceByName deletes a device by name
func (*Client) DeleteDeviceProfileById ¶
DeleteDeviceProfileById deletes a device profile by id
func (*Client) DeleteDeviceProfileByName ¶
DeleteDeviceProfileByName deletes a device profile by name
func (*Client) DeleteDeviceServiceById ¶
DeleteDeviceServiceById deletes a device service by id
func (*Client) DeleteDeviceServiceByName ¶
DeleteDeviceServiceByName deletes a device service by name
func (*Client) DeleteEventById ¶
DeleteEventById removes an event by id
func (*Client) DeleteEventsByDeviceName ¶
DeleteEventsByDeviceName deletes all pushed events and corresponding readings. This function is implemented to starts up two goroutines to delete readings and events in the bckground to achieve better performance.
func (*Client) DeletePushedEvents ¶
DeletePushedEvents deletes all pushed events and corresponding readings. This function is implemented to starts up two goroutines to delete readings and events in the bckground to achieve better performance.
func (*Client) DeviceById ¶
DeviceById gets a device by id
func (*Client) DeviceByName ¶
DeviceByName gets a device by name
func (*Client) DeviceIdExists ¶
DeviceIdExists checks the device existence by id
func (*Client) DeviceNameExists ¶
DeviceNameExists checks the device existence by name
func (*Client) DeviceProfileByName ¶
func (c *Client) DeviceProfileByName(name string) (deviceProfile model.DeviceProfile, edgeXerr errors.EdgeX)
DeviceProfileByName gets a device profile by name
func (*Client) DeviceProfileNameExists ¶
DeviceProfileNameExists checks the device profile exists by name
func (*Client) DeviceServiceById ¶
func (c *Client) DeviceServiceById(id string) (deviceService model.DeviceService, edgeXerr errors.EdgeX)
DeviceServiceById gets a device service by id
func (*Client) DeviceServiceByName ¶
func (c *Client) DeviceServiceByName(name string) (deviceService model.DeviceService, edgeXerr errors.EdgeX)
DeviceServiceByName gets a device service by name
func (*Client) DeviceServiceNameExists ¶
DeviceServiceNameExists checks the device service exists by name
func (*Client) DevicesByServiceName ¶
func (c *Client) DevicesByServiceName(offset int, limit int, name string) (devices []model.Device, edgeXerr errors.EdgeX)
DevicesByServiceName query devices by offset, limit and name
func (*Client) EventCountByDevice ¶
EventCountByDevice returns the count of Event associated a specific Device from the database
func (*Client) EventTotalCount ¶
EventTotalCount returns the total count of Event from the database
func (*Client) EventsByDeviceName ¶
func (c *Client) EventsByDeviceName(offset int, limit int, name string) (events []model.Event, edgeXerr errors.EdgeX)
EventsByDeviceName query events by offset, limit and device name
func (*Client) EventsByTimeRange ¶
func (c *Client) EventsByTimeRange(start int, end int, offset int, limit int) (events []model.Event, edgeXerr errors.EdgeX)
EventsByTimeRange query events by time range, offset, and limit
func (*Client) UpdateDeviceProfile ¶
func (c *Client) UpdateDeviceProfile(dp model.DeviceProfile) errors.EdgeX
UpdateDeviceProfile updates a new device profile