repo

package
v0.2.17 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddSensorToDeviceParams

type AddSensorToDeviceParams struct {
	SensorID int32 `json:"sensor_id"`
	DeviceID int32 `json:"device_id"`
}

type Attribute

type Attribute struct {
	AttributeID   int32  `json:"attribute_id"`
	AttributeName string `json:"attribute_name"`
	AttributeDesc string `json:"attribute_desc"`
	AttributeUnit string `json:"attribute_unit"`
}

type Config

type Config struct {
	Ckey   string         `json:"ckey"`
	Cvalue sql.NullString `json:"cvalue"`
	Ctype  int32          `json:"ctype"`
}

type CreateAttributeParams

type CreateAttributeParams struct {
	AttributeID   int32  `json:"attribute_id"`
	AttributeName string `json:"attribute_name"`
	AttributeDesc string `json:"attribute_desc"`
	AttributeUnit string `json:"attribute_unit"`
}

type CreateDeviceAddrParams

type CreateDeviceAddrParams struct {
	DeviceID int32  `json:"device_id"`
	IpAddr   string `json:"ip_addr"`
	MacAddr  string `json:"mac_addr"`
	Port     int32  `json:"port"`
}

type CreateDeviceParams

type CreateDeviceParams struct {
	DeviceID   int32  `json:"device_id"`
	DeviceName string `json:"device_name"`
	LocationID int32  `json:"location_id"`
	DeviceDesc string `json:"device_desc"`
}

type CreateLocationParams

type CreateLocationParams struct {
	LocationID   int32  `json:"location_id"`
	LocationName string `json:"location_name"`
	LocationDesc string `json:"location_desc"`
}

type CreateMessageParams added in v0.2.1

type CreateMessageParams struct {
	Title           string         `json:"title"`
	Topic           string         `json:"topic"`
	Payload         string         `json:"payload"`
	Tags            sql.NullString `json:"tags"`
	Messagepriority int32          `json:"messagepriority"`
}

type CreateSensorsParams

type CreateSensorsParams struct {
	SensorID   int32  `json:"sensor_id"`
	SensorName string `json:"sensor_name"`
	SensorDesc string `json:"sensor_desc"`
}

type CreateThresholdParams added in v0.2.1

type CreateThresholdParams struct {
	SensorID       int32           `json:"sensor_id"`
	DeviceID       int32           `json:"device_id"`
	AttributeID    int32           `json:"attribute_id"`
	MessageID      int32           `json:"message_id"`
	Value1         float64         `json:"value1"`
	Value2         sql.NullFloat64 `json:"value2"`
	Frequency      int32           `json:"frequency"`
	OperatorID     int32           `json:"operator_id"`
	Triggername    string          `json:"triggername"`
	Triggerenabled bool            `json:"triggerenabled"`
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type Device

type Device struct {
	DeviceID   int32  `json:"device_id"`
	DeviceName string `json:"device_name"`
	LocationID int32  `json:"location_id"`
	DeviceDesc string `json:"device_desc"`
}

type Deviceaddr

type Deviceaddr struct {
	DeviceID int32  `json:"device_id"`
	IpAddr   string `json:"ip_addr"`
	MacAddr  string `json:"mac_addr"`
	Port     int32  `json:"port"`
}

type Devicelocation

type Devicelocation struct {
	LocationID   int32  `json:"location_id"`
	LocationName string `json:"location_name"`
	LocationDesc string `json:"location_desc"`
}

type Devicestate

type Devicestate struct {
	DeviceID     int32 `json:"device_id"`
	Isrestarting bool  `json:"isrestarting"`
	Isrunning    bool  `json:"isrunning"`
	Isupdating   bool  `json:"isupdating"`
}

type GetAllDeviceInformationRow

type GetAllDeviceInformationRow struct {
	DeviceID   int32  `json:"device_id"`
	DeviceName string `json:"device_name"`
	LocationID int32  `json:"location_id"`
	DeviceDesc string `json:"device_desc"`
	IpAddr     string `json:"ip_addr"`
	MacAddr    string `json:"mac_addr"`
	Port       int32  `json:"port"`
}

type GetAttributesListRow added in v0.2.1

type GetAttributesListRow struct {
	AttributeID   int32  `json:"attribute_id"`
	AttributeName string `json:"attribute_name"`
}

type GetDeviceSensorsRow

type GetDeviceSensorsRow struct {
	SensorID   int32  `json:"sensor_id"`
	SensorName string `json:"sensor_name"`
}

type GetDevicesListRow added in v0.2.1

type GetDevicesListRow struct {
	DeviceID   int32  `json:"device_id"`
	DeviceName string `json:"device_name"`
}

type GetHighestMeasurementOfLastHourParams

type GetHighestMeasurementOfLastHourParams struct {
	SensorID    int32 `json:"sensor_id"`
	DeviceID    int32 `json:"device_id"`
	AttributeID int32 `json:"attribute_id"`
}

type GetLatestMeasurementParams

type GetLatestMeasurementParams struct {
	SensorID    int32 `json:"sensor_id"`
	DeviceID    int32 `json:"device_id"`
	AttributeID int32 `json:"attribute_id"`
}

type GetMessageslistRow added in v0.2.1

type GetMessageslistRow struct {
	ID    int32  `json:"id"`
	Title string `json:"title"`
}

type GetSensorsListRow added in v0.2.1

type GetSensorsListRow struct {
	SensorID   int32  `json:"sensor_id"`
	SensorName string `json:"sensor_name"`
}

type InsertMeasurementParams

type InsertMeasurementParams struct {
	Mtime       time.Time `json:"mtime"`
	SensorID    int32     `json:"sensor_id"`
	DeviceID    int32     `json:"device_id"`
	AttributeID int32     `json:"attribute_id"`
	Mvalue      float64   `json:"mvalue"`
}

type Measurement

type Measurement struct {
	Mtime       time.Time `json:"mtime"`
	SensorID    int32     `json:"sensor_id"`
	DeviceID    int32     `json:"device_id"`
	AttributeID int32     `json:"attribute_id"`
	Mvalue      float64   `json:"mvalue"`
}

type Notificationmessage

type Notificationmessage struct {
	ID              int32          `json:"id"`
	Title           string         `json:"title"`
	Topic           string         `json:"topic"`
	Payload         string         `json:"payload"`
	Tags            sql.NullString `json:"tags"`
	Messagepriority int32          `json:"messagepriority"`
	CreatedAt       time.Time      `json:"created_at"`
	UpdatedAt       time.Time      `json:"updated_at"`
}

type Operator

type Operator struct {
	ID        int32  `json:"id"`
	Op        string `json:"op"`
	Variables int32  `json:"variables"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func Prepare

func Prepare(ctx context.Context, db DBTX) (*Queries, error)

func (*Queries) AddSensorToDevice

func (q *Queries) AddSensorToDevice(ctx context.Context, arg AddSensorToDeviceParams) error

func (*Queries) AttributeIdFromName

func (q *Queries) AttributeIdFromName(ctx context.Context, attributeName string) (int32, error)

func (*Queries) Close

func (q *Queries) Close() error

func (*Queries) CreateAttribute

func (q *Queries) CreateAttribute(ctx context.Context, arg CreateAttributeParams) error

func (*Queries) CreateDevice

func (q *Queries) CreateDevice(ctx context.Context, arg CreateDeviceParams) error

func (*Queries) CreateDeviceAddr

func (q *Queries) CreateDeviceAddr(ctx context.Context, arg CreateDeviceAddrParams) error

func (*Queries) CreateLocation

func (q *Queries) CreateLocation(ctx context.Context, arg CreateLocationParams) error

func (*Queries) CreateMessage added in v0.2.1

func (q *Queries) CreateMessage(ctx context.Context, arg CreateMessageParams) (Notificationmessage, error)

func (*Queries) CreateSensors

func (q *Queries) CreateSensors(ctx context.Context, arg CreateSensorsParams) error

func (*Queries) CreateThreshold added in v0.2.1

func (q *Queries) CreateThreshold(ctx context.Context, arg CreateThresholdParams) (Threshold, error)

func (*Queries) DeleteConfigByKey

func (q *Queries) DeleteConfigByKey(ctx context.Context, ckey string) (Config, error)

func (*Queries) DeleteDeviceSensors

func (q *Queries) DeleteDeviceSensors(ctx context.Context, deviceID int32) error

func (*Queries) DeleteMessage added in v0.2.1

func (q *Queries) DeleteMessage(ctx context.Context, id int32) (Notificationmessage, error)

func (*Queries) DeleteThreshold added in v0.2.1

func (q *Queries) DeleteThreshold(ctx context.Context, id int32) (Threshold, error)

func (*Queries) GetAllAttributes

func (q *Queries) GetAllAttributes(ctx context.Context) ([]Attribute, error)

func (*Queries) GetAllDeviceInformation

func (q *Queries) GetAllDeviceInformation(ctx context.Context) ([]GetAllDeviceInformationRow, error)

func (*Queries) GetAttributesList added in v0.2.1

func (q *Queries) GetAttributesList(ctx context.Context) ([]GetAttributesListRow, error)

func (*Queries) GetConfigByKey

func (q *Queries) GetConfigByKey(ctx context.Context, ckey string) (Config, error)

func (*Queries) GetDeviceSensors

func (q *Queries) GetDeviceSensors(ctx context.Context, deviceID int32) ([]GetDeviceSensorsRow, error)

func (*Queries) GetDevicesList added in v0.2.1

func (q *Queries) GetDevicesList(ctx context.Context) ([]GetDevicesListRow, error)

func (*Queries) GetExpiredSecrets

func (q *Queries) GetExpiredSecrets(ctx context.Context) ([]Secret, error)

func (*Queries) GetHighestMeasurementOfLastHour

func (q *Queries) GetHighestMeasurementOfLastHour(ctx context.Context, arg GetHighestMeasurementOfLastHourParams) (interface{}, error)

func (*Queries) GetIntervalConfig

func (q *Queries) GetIntervalConfig(ctx context.Context) (int32, error)

func (*Queries) GetLatestMeasurement

func (q *Queries) GetLatestMeasurement(ctx context.Context, arg GetLatestMeasurementParams) (Measurement, error)

func (*Queries) GetLocations

func (q *Queries) GetLocations(ctx context.Context) ([]Devicelocation, error)

func (*Queries) GetMessages added in v0.2.1

func (q *Queries) GetMessages(ctx context.Context, id int32) (Notificationmessage, error)

func (*Queries) GetMessageslist added in v0.2.1

func (q *Queries) GetMessageslist(ctx context.Context) ([]GetMessageslistRow, error)

func (*Queries) GetOperators added in v0.2.1

func (q *Queries) GetOperators(ctx context.Context) ([]Operator, error)

func (*Queries) GetSecretByName

func (q *Queries) GetSecretByName(ctx context.Context, name string) (Secret, error)

func (*Queries) GetSensors

func (q *Queries) GetSensors(ctx context.Context) ([]Sensor, error)

func (*Queries) GetSensorsList added in v0.2.1

func (q *Queries) GetSensorsList(ctx context.Context) ([]GetSensorsListRow, error)

func (*Queries) GetThresholds added in v0.2.1

func (q *Queries) GetThresholds(ctx context.Context) ([]Threshold, error)

func (*Queries) InsertMeasurement

func (q *Queries) InsertMeasurement(ctx context.Context, arg InsertMeasurementParams) error

func (*Queries) LoadConfigData

func (q *Queries) LoadConfigData(ctx context.Context, dollar_1 []string) ([]Config, error)

func (*Queries) SetConfigBykey

func (q *Queries) SetConfigBykey(ctx context.Context, arg SetConfigBykeyParams) error

func (*Queries) UpdateAttribute

func (q *Queries) UpdateAttribute(ctx context.Context, arg UpdateAttributeParams) error

func (*Queries) UpdateDevice

func (q *Queries) UpdateDevice(ctx context.Context, arg UpdateDeviceParams) error

func (*Queries) UpdateDeviceAddr

func (q *Queries) UpdateDeviceAddr(ctx context.Context, arg UpdateDeviceAddrParams) error

func (*Queries) UpdateLocation

func (q *Queries) UpdateLocation(ctx context.Context, arg UpdateLocationParams) error

func (*Queries) UpdateMessage added in v0.2.1

func (q *Queries) UpdateMessage(ctx context.Context, arg UpdateMessageParams) (Notificationmessage, error)

func (*Queries) UpdateSecret

func (q *Queries) UpdateSecret(ctx context.Context, arg UpdateSecretParams) error

func (*Queries) UpdateSensors

func (q *Queries) UpdateSensors(ctx context.Context, arg UpdateSensorsParams) error

func (*Queries) UpdateThreshold added in v0.2.1

func (q *Queries) UpdateThreshold(ctx context.Context, arg UpdateThresholdParams) (Threshold, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type Reminder

type Reminder struct {
	ID              int32        `json:"id"`
	MessageID       int32        `json:"message_id"`
	Frequency       int32        `json:"frequency"`
	Remindername    string       `json:"remindername"`
	Reminderenabled bool         `json:"reminderenabled"`
	CreatedAt       time.Time    `json:"created_at"`
	UpdatedAt       time.Time    `json:"updated_at"`
	LastReminded    sql.NullTime `json:"last_reminded"`
}

type Remindersdevice

type Remindersdevice struct {
	ID       int32  `json:"id"`
	DeviceID int32  `json:"device_id"`
	Rname    string `json:"rname"`
}

type Secret

type Secret struct {
	ID        int32        `json:"id"`
	Name      string       `json:"name"`
	Value     string       `json:"value"`
	ExpiresAt sql.NullTime `json:"expires_at"`
	CreatedAt time.Time    `json:"created_at"`
	UpdatedAt time.Time    `json:"updated_at"`
}

type Sensor

type Sensor struct {
	SensorID   int32  `json:"sensor_id"`
	SensorName string `json:"sensor_name"`
	SensorDesc string `json:"sensor_desc"`
}

type Sensordevice

type Sensordevice struct {
	SensorID int32 `json:"sensor_id"`
	DeviceID int32 `json:"device_id"`
}

type SetConfigBykeyParams

type SetConfigBykeyParams struct {
	Column1 []string `json:"column_1"`
	Column2 []string `json:"column_2"`
}

type Threshold

type Threshold struct {
	ID             int32           `json:"id"`
	SensorID       int32           `json:"sensor_id"`
	DeviceID       int32           `json:"device_id"`
	AttributeID    int32           `json:"attribute_id"`
	MessageID      int32           `json:"message_id"`
	Value1         float64         `json:"value1"`
	Value2         sql.NullFloat64 `json:"value2"`
	Frequency      int32           `json:"frequency"`
	CreatedAt      time.Time       `json:"created_at"`
	UpdatedAt      time.Time       `json:"updated_at"`
	LastTriggered  sql.NullTime    `json:"last_triggered"`
	OperatorID     int32           `json:"operator_id"`
	Triggername    string          `json:"triggername"`
	Triggerenabled bool            `json:"triggerenabled"`
}

type UpdateAttributeParams

type UpdateAttributeParams struct {
	AttributeName string `json:"attribute_name"`
	AttributeDesc string `json:"attribute_desc"`
	AttributeUnit string `json:"attribute_unit"`
	AttributeID   int32  `json:"attribute_id"`
}

type UpdateDeviceAddrParams

type UpdateDeviceAddrParams struct {
	DeviceID int32  `json:"device_id"`
	IpAddr   string `json:"ip_addr"`
	MacAddr  string `json:"mac_addr"`
	Port     int32  `json:"port"`
}

type UpdateDeviceParams

type UpdateDeviceParams struct {
	DeviceID   int32  `json:"device_id"`
	DeviceName string `json:"device_name"`
	LocationID int32  `json:"location_id"`
	DeviceDesc string `json:"device_desc"`
}

type UpdateLocationParams

type UpdateLocationParams struct {
	LocationName string `json:"location_name"`
	LocationDesc string `json:"location_desc"`
	LocationID   int32  `json:"location_id"`
}

type UpdateMessageParams added in v0.2.1

type UpdateMessageParams struct {
	Title           string         `json:"title"`
	Topic           string         `json:"topic"`
	Payload         string         `json:"payload"`
	Tags            sql.NullString `json:"tags"`
	Messagepriority int32          `json:"messagepriority"`
	ID              int32          `json:"id"`
}

type UpdateSecretParams

type UpdateSecretParams struct {
	Name      string       `json:"name"`
	Value     string       `json:"value"`
	ExpiresAt sql.NullTime `json:"expires_at"`
}

type UpdateSensorsParams

type UpdateSensorsParams struct {
	SensorName string `json:"sensor_name"`
	SensorDesc string `json:"sensor_desc"`
	SensorID   int32  `json:"sensor_id"`
}

type UpdateThresholdParams added in v0.2.1

type UpdateThresholdParams struct {
	SensorID       int32           `json:"sensor_id"`
	DeviceID       int32           `json:"device_id"`
	AttributeID    int32           `json:"attribute_id"`
	MessageID      int32           `json:"message_id"`
	Value1         float64         `json:"value1"`
	Value2         sql.NullFloat64 `json:"value2"`
	Frequency      int32           `json:"frequency"`
	OperatorID     int32           `json:"operator_id"`
	Triggername    string          `json:"triggername"`
	Triggerenabled bool            `json:"triggerenabled"`
	ID             int32           `json:"id"`
}

Jump to

Keyboard shortcuts

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