coredata

package
v0.0.0-...-7b61fee Latest Latest
Warning

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

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

README

README

This package contains the core data client written in the Go programming language. The core data client is used by Go services or other Go code to communicate with the EdgeX core-data microservice (regardless of underlying implemenation type) by sending REST requests to the service's API endpoints.

How To Use

To use the core-data client package you first need to import the library into your project:

import "github.com/Circutor/edgex/pkg/clients/coredata"

As an example of use, to find a Value Descriptor using the Core Data client, first create a new device client

vdc := NewValueDescriptorClient(params, types.Endpoint{})

And then use the client to get all value descriptors

vdc.ValueDescriptors()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventClient

type EventClient interface {
	Events(ctx context.Context) ([]models.Event, error)
	EventsUnpushed(ctx context.Context, nUnpushed int) ([]models.Event, error)
	Event(id string, ctx context.Context) (models.Event, error)
	EventCount(ctx context.Context) (int, error)
	EventCountForDevice(deviceId string, ctx context.Context) (int, error)
	EventsForDevice(id string, limit int, ctx context.Context) ([]models.Event, error)
	EventsForInterval(start int, end int, limit int, ctx context.Context) ([]models.Event, error)
	EventsForDeviceAndValueDescriptor(deviceId string, vd string, limit int, ctx context.Context) ([]models.Event, error)
	Add(event *models.Event, ctx context.Context) (string, error)
	DeleteForDevice(id string, ctx context.Context) error
	DeleteOld(age int, ctx context.Context) error
	Delete(id string, ctx context.Context) error
	MarkPushed(id string, ctx context.Context) error
}

func NewEventClient

func NewEventClient(url string) EventClient

type EventRestClient

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

func (*EventRestClient) Add

func (e *EventRestClient) Add(event *models.Event, ctx context.Context) (string, error)

Add event

func (*EventRestClient) Delete

func (e *EventRestClient) Delete(id string, ctx context.Context) error

Delete event by id

func (*EventRestClient) DeleteForDevice

func (e *EventRestClient) DeleteForDevice(deviceId string, ctx context.Context) error

Delete events by device name

func (*EventRestClient) DeleteOld

func (e *EventRestClient) DeleteOld(age int, ctx context.Context) error

Delete events by age

func (*EventRestClient) Event

func (e *EventRestClient) Event(id string, ctx context.Context) (models.Event, error)

Get the event by id

func (*EventRestClient) EventCount

func (e *EventRestClient) EventCount(ctx context.Context) (int, error)

Get event count

func (*EventRestClient) EventCountForDevice

func (e *EventRestClient) EventCountForDevice(deviceId string, ctx context.Context) (int, error)

Get event count for device

func (*EventRestClient) Events

func (e *EventRestClient) Events(ctx context.Context) ([]models.Event, error)

Get a list of all events

func (*EventRestClient) EventsForDevice

func (e *EventRestClient) EventsForDevice(deviceId string, limit int, ctx context.Context) ([]models.Event, error)

Get events for device

func (*EventRestClient) EventsForDeviceAndValueDescriptor

func (e *EventRestClient) EventsForDeviceAndValueDescriptor(deviceId string, vd string, limit int, ctx context.Context) ([]models.Event, error)

Get events for device and value descriptor

func (*EventRestClient) EventsForInterval

func (e *EventRestClient) EventsForInterval(start int, end int, limit int, ctx context.Context) ([]models.Event, error)

Get events for interval

func (*EventRestClient) EventsUnpushed

func (e *EventRestClient) EventsUnpushed(ctx context.Context, nUnpushed int) ([]models.Event, error)

Get a list of all unpushed events

func (*EventRestClient) MarkPushed

func (e *EventRestClient) MarkPushed(id string, ctx context.Context) error

Mark event as pushed

Jump to

Keyboard shortcuts

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