Documentation ¶
Index ¶
- Variables
- func NewPool(ctx context.Context, config Config) (*pgxpool.Pool, error)
- type Box
- type Condition
- type ConditionFunc
- func WithActive(active bool) ConditionFunc
- func WithAlarmID(alarmID string) ConditionFunc
- func WithBounds(north, south, east, west float64) ConditionFunc
- func WithDeleted() ConditionFunc
- func WithDeviceAlarmID(alarmID string) ConditionFunc
- func WithDeviceID(deviceID string) ConditionFunc
- func WithLastSeen(ts time.Time) ConditionFunc
- func WithLimit(limit int) ConditionFunc
- func WithOffset(offset int) ConditionFunc
- func WithOnline(online bool) ConditionFunc
- func WithProfileName(profileName []string) ConditionFunc
- func WithRefID(refID string) ConditionFunc
- func WithSearch(s string) ConditionFunc
- func WithSensorID(sensorID string) ConditionFunc
- func WithSortBy(sortBy string) ConditionFunc
- func WithSortDesc(desc bool) ConditionFunc
- func WithTenant(tenant string) ConditionFunc
- func WithTenants(tenants []string) ConditionFunc
- func WithTypes(types []string) ConditionFunc
- func WithUrn(urn []string) ConditionFunc
- type Config
- type Storage
- func (s *Storage) AddAlarm(ctx context.Context, alarm types.Alarm) error
- func (s *Storage) AddDevice(ctx context.Context, device types.Device) error
- func (s *Storage) Close()
- func (s *Storage) CloseAlarm(ctx context.Context, alarmID, tenant string) error
- func (s *Storage) CreateTables(ctx context.Context) error
- func (s *Storage) GetAlarm(ctx context.Context, conditions ...ConditionFunc) (types.Alarm, error)
- func (s *Storage) GetDevice(ctx context.Context, conditions ...ConditionFunc) (types.Device, error)
- func (s *Storage) GetTags(ctx context.Context, deviceID, tenant string) ([]types.Tag, error)
- func (s *Storage) GetTenants(ctx context.Context) ([]string, error)
- func (s *Storage) QueryAlarms(ctx context.Context, conditions ...ConditionFunc) (types.Collection[types.Alarm], error)
- func (s *Storage) QueryDevices(ctx context.Context, conditions ...ConditionFunc) (types.Collection[types.Device], error)
- func (s *Storage) QueryInformation(ctx context.Context, conditions ...ConditionFunc) (types.Collection[types.InformationItem], error)
- func (s *Storage) SetActive(ctx context.Context, deviceID, tenant string, active bool) error
- func (s *Storage) SetTenant(ctx context.Context, deviceID, tenant string) error
- func (s *Storage) UpdateDevice(ctx context.Context, device types.Device) error
- func (s *Storage) UpdateState(ctx context.Context, deviceID, tenant string, deviceState types.DeviceState) error
- func (s *Storage) UpdateStatus(ctx context.Context, deviceID, tenant string, deviceStatus types.DeviceStatus) error
- func (s *Storage) UpdateTags(ctx context.Context, deviceID, tenant string, tags []types.Tag) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoRows = errors.New("no rows in result set") ErrTooManyRows = errors.New("too many rows in result set") ErrQueryRow = errors.New("could not execute query") ErrStoreFailed = errors.New("could not store data") ErrNoID = errors.New("data contains no id") ErrMissingTenant = errors.New("missing tenant information") ErrAlreadyExist = errors.New("device already exists") ErrDeleted = errors.New("deleted") )
Functions ¶
Types ¶
type Condition ¶
type Condition struct { DeviceID string SensorID string DeviceWithAlarmID string Types []string Tenants []string ProfileName []string Active *bool Online *bool Bounds *Box AlarmID string RefID string IncludeDeleted bool Urn []string Search string LastSeen time.Time // contains filtered or unexported fields }
type ConditionFunc ¶
func WithActive ¶
func WithActive(active bool) ConditionFunc
func WithAlarmID ¶
func WithAlarmID(alarmID string) ConditionFunc
func WithBounds ¶
func WithBounds(north, south, east, west float64) ConditionFunc
func WithDeleted ¶
func WithDeleted() ConditionFunc
func WithDeviceAlarmID ¶
func WithDeviceAlarmID(alarmID string) ConditionFunc
func WithDeviceID ¶
func WithDeviceID(deviceID string) ConditionFunc
func WithLastSeen ¶
func WithLastSeen(ts time.Time) ConditionFunc
func WithLimit ¶
func WithLimit(limit int) ConditionFunc
func WithOffset ¶
func WithOffset(offset int) ConditionFunc
func WithOnline ¶
func WithOnline(online bool) ConditionFunc
func WithProfileName ¶
func WithProfileName(profileName []string) ConditionFunc
func WithRefID ¶
func WithRefID(refID string) ConditionFunc
func WithSearch ¶
func WithSearch(s string) ConditionFunc
func WithSensorID ¶
func WithSensorID(sensorID string) ConditionFunc
func WithSortBy ¶
func WithSortBy(sortBy string) ConditionFunc
func WithSortDesc ¶
func WithSortDesc(desc bool) ConditionFunc
func WithTenant ¶
func WithTenant(tenant string) ConditionFunc
func WithTenants ¶
func WithTenants(tenants []string) ConditionFunc
func WithTypes ¶
func WithTypes(types []string) ConditionFunc
func WithUrn ¶
func WithUrn(urn []string) ConditionFunc
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func LoadConfiguration ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func NewWithPool ¶
func (*Storage) CloseAlarm ¶
func (*Storage) QueryAlarms ¶
func (s *Storage) QueryAlarms(ctx context.Context, conditions ...ConditionFunc) (types.Collection[types.Alarm], error)
func (*Storage) QueryDevices ¶
func (s *Storage) QueryDevices(ctx context.Context, conditions ...ConditionFunc) (types.Collection[types.Device], error)
func (*Storage) QueryInformation ¶
func (s *Storage) QueryInformation(ctx context.Context, conditions ...ConditionFunc) (types.Collection[types.InformationItem], error)
func (*Storage) UpdateDevice ¶
func (*Storage) UpdateState ¶
func (*Storage) UpdateStatus ¶
Click to show internal directories.
Click to hide internal directories.