store

package
v0.0.0-...-f92ee09 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCalExists = errors.New("Calibration entry already exists")

ErrCalExists indicates that calibration entry already exists

Functions

This section is empty.

Types

type Store

type Store interface {

	// PutCal adds a new calibration entry.  Note that the device
	// referred to must already exist in the database.
	PutCal(c *model.Cal) (int64, error)

	// GetCal gets a calibration entry by id
	GetCal(id int64) (*model.Cal, error)

	// DeleteCal deletes calibration entry.
	DeleteCal(id int64) error

	// ListCal lists calibration data ordered by DeviceID and ValidFrom in ascending order.
	ListCals(offset int, limit int) ([]model.Cal, error)

	// ListCalForDevice lists calibration data for device ordered by
	// validFrom date in descending order.
	ListCalsForDevice(deviceID string) ([]model.Cal, error)

	// PutMessage adds a new message to database
	PutMessage(m *model.Message) (int64, error)

	// GetMessage gets a message by id
	GetMessage(id int64) (*model.Message, error)

	// ListMessages pages through messages.  Messages are sorted in descending order by ReceivedTime.
	ListMessages(offset int, limit int) ([]model.Message, error)

	// ListMessagesByDate lists messages by date [from:to>
	ListMessagesByDate(from int64, to int64) ([]model.Message, error)

	// ListDeviceMessagesByDate lists messages by device and date [from:to>
	ListDeviceMessagesByDate(deviceID string, from int64, to int64) ([]model.Message, error)

	// Close the database
	Close() error
}

Store defines the persistence interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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