Documentation
¶
Index ¶
- type CreateReadingParams
- type CreateSensorParams
- type DBTX
- type GetSensorReadingStatsParams
- type GetSensorReadingStatsRow
- type ListReadingBySensorIdParams
- type ListReadingFilterBySensorIdRecordedAtFlaggedParams
- type ListReadingFilterBySensorIdRecordedAtFlaggedRow
- type ListSensorFilterByLabelKindActiveParams
- type ListSensorFilterByLabelKindActiveRow
- type ListSensorsWithLatestReadingParams
- type ListSensorsWithLatestReadingRow
- type Queries
- func (q *Queries) CreateReading(ctx context.Context, arg CreateReadingParams) (int64, error)
- func (q *Queries) CreateSensor(ctx context.Context, arg CreateSensorParams) (int64, error)
- func (q *Queries) DB() DBTX
- func (q *Queries) DeleteReading(ctx context.Context, id int64) error
- func (q *Queries) DeleteSensor(ctx context.Context, id int64) error
- func (q *Queries) GetReadingByID(ctx context.Context, id int64) (Reading, error)
- func (q *Queries) GetSensorByCode(ctx context.Context, code string) (Sensor, error)
- func (q *Queries) GetSensorByID(ctx context.Context, id int64) (Sensor, error)
- func (q *Queries) GetSensorReadingStats(ctx context.Context, arg GetSensorReadingStatsParams) (GetSensorReadingStatsRow, error)
- func (q *Queries) ListReadingBySensorId(ctx context.Context, arg ListReadingBySensorIdParams) ([]Reading, error)
- func (q *Queries) ListReadingFilterBySensorIdRecordedAtFlagged(ctx context.Context, arg ListReadingFilterBySensorIdRecordedAtFlaggedParams) ([]ListReadingFilterBySensorIdRecordedAtFlaggedRow, error)
- func (q *Queries) ListSensorFilterByLabelKindActive(ctx context.Context, arg ListSensorFilterByLabelKindActiveParams) ([]ListSensorFilterByLabelKindActiveRow, error)
- func (q *Queries) ListSensorsWithLatestReading(ctx context.Context, arg ListSensorsWithLatestReadingParams) ([]ListSensorsWithLatestReadingRow, error)
- func (q *Queries) PruneReadingsOlderThan(ctx context.Context, cutoff time.Time) (int64, error)
- func (q *Queries) UpdateReading(ctx context.Context, arg UpdateReadingParams) (Reading, error)
- func (q *Queries) UpdateSensor(ctx context.Context, arg UpdateSensorParams) (Sensor, error)
- func (q *Queries) WithTx(tx *sql.Tx) *Queries
- type Reading
- type Sensor
- type UpdateReadingParams
- type UpdateSensorParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateReadingParams ¶
type CreateSensorParams ¶
type CreateSensorParams struct {
Code string `json:"code"`
Label string `json:"label"`
Kind string `json:"kind"`
Unit string `json:"unit"`
Location *string `json:"location"`
Active int64 `json:"active"`
Firmware string `json:"firmware"`
SampleRateMs int64 `json:"sample_rate_ms"`
InstalledAt time.Time `json:"installed_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type ListReadingBySensorIdParams ¶ added in v0.0.4
type ListReadingFilterBySensorIdRecordedAtFlaggedRow ¶ added in v0.0.5
type ListReadingFilterBySensorIdRecordedAtFlaggedRow struct {
ID int64 `json:"id"`
SensorID int64 `json:"sensor_id"`
Value float64 `json:"value"`
Quality int64 `json:"quality"`
Flagged int64 `json:"flagged"`
RecordedAt time.Time `json:"recorded_at"`
CreatedAt time.Time `json:"created_at"`
TotalSize int64 `json:"total_size"`
}
type ListSensorFilterByLabelKindActiveRow ¶ added in v0.0.5
type ListSensorFilterByLabelKindActiveRow struct {
ID int64 `json:"id"`
Code string `json:"code"`
Label string `json:"label"`
Kind string `json:"kind"`
Unit string `json:"unit"`
Location *string `json:"location"`
Active int64 `json:"active"`
Firmware string `json:"firmware"`
SampleRateMs int64 `json:"sample_rate_ms"`
InstalledAt time.Time `json:"installed_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
TotalSize int64 `json:"total_size"`
}
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) CreateReading ¶
Code generated by entlite. DO NOT EDIT. SQLC compatible query definitions Reading CRUD operations
func (*Queries) CreateSensor ¶
Sensor CRUD operations
func (*Queries) DeleteReading ¶
func (*Queries) GetReadingByID ¶
func (*Queries) GetSensorByCode ¶
Look up a sensor by its hardware code
func (*Queries) GetSensorByID ¶
func (*Queries) GetSensorReadingStats ¶
func (q *Queries) GetSensorReadingStats(ctx context.Context, arg GetSensorReadingStatsParams) (GetSensorReadingStatsRow, error)
Hand-written queries the DSL cannot express. entlite never writes this file. The tables are defined in the generated schema.sql. Aggregate value statistics for a single sensor over a time window. >= / <= instead of BETWEEN: sqlc cannot infer a DATETIME type inside BETWEEN and drops the bounds from the params struct.
func (*Queries) ListReadingBySensorId ¶
func (*Queries) ListReadingFilterBySensorIdRecordedAtFlagged ¶
func (q *Queries) ListReadingFilterBySensorIdRecordedAtFlagged(ctx context.Context, arg ListReadingFilterBySensorIdRecordedAtFlaggedParams) ([]ListReadingFilterBySensorIdRecordedAtFlaggedRow, error)
func (*Queries) ListSensorFilterByLabelKindActive ¶
func (q *Queries) ListSensorFilterByLabelKindActive(ctx context.Context, arg ListSensorFilterByLabelKindActiveParams) ([]ListSensorFilterByLabelKindActiveRow, error)
func (*Queries) ListSensorsWithLatestReading ¶
func (q *Queries) ListSensorsWithLatestReading(ctx context.Context, arg ListSensorsWithLatestReadingParams) ([]ListSensorsWithLatestReadingRow, error)
Every active sensor with its most recent reading. LEFT JOIN, so a sensor that never reported comes back with NULL latest values. sqlc.embed(s) maps the joined columns back to the Sensor struct.
func (*Queries) PruneReadingsOlderThan ¶
Drops readings older than a cutoff.
func (*Queries) UpdateReading ¶
func (*Queries) UpdateSensor ¶
type Sensor ¶
type Sensor struct {
ID int64 `json:"id"`
Code string `json:"code"`
Label string `json:"label"`
Kind string `json:"kind"`
Unit string `json:"unit"`
Location *string `json:"location"`
Active int64 `json:"active"`
Firmware string `json:"firmware"`
SampleRateMs int64 `json:"sample_rate_ms"`
InstalledAt time.Time `json:"installed_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type UpdateReadingParams ¶
type UpdateSensorParams ¶
type UpdateSensorParams struct {
Code string `json:"code"`
Label string `json:"label"`
Kind string `json:"kind"`
Unit string `json:"unit"`
Location *string `json:"location"`
Active *int64 `json:"active"`
Firmware *string `json:"firmware"`
SampleRateMs *int64 `json:"sample_rate_ms"`
UpdatedAt time.Time `json:"updated_at"`
ID int64 `json:"ID"`
}