Documentation
¶
Index ¶
- type CreateReadingParams
- type CreateSensorParams
- type DBTX
- type GetSensorReadingStatsParams
- type GetSensorReadingStatsRow
- type ListReadingFilterBySensorIdRecordedAtFlaggedParams
- type ListSensorFilterByLabelKindActiveParams
- 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, sensorID int64) ([]Reading, error)
- func (q *Queries) ListReadingFilterBySensorIdRecordedAtFlagged(ctx context.Context, arg ListReadingFilterBySensorIdRecordedAtFlaggedParams) ([]Reading, error)
- func (q *Queries) ListSensorFilterByLabelKindActive(ctx context.Context, arg ListSensorFilterByLabelKindActiveParams) ([]Sensor, 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 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 ¶
func (*Queries) GetSensorByID ¶
func (*Queries) GetSensorReadingStats ¶
func (q *Queries) GetSensorReadingStats(ctx context.Context, arg GetSensorReadingStatsParams) (GetSensorReadingStatsRow, error)
custom.sql
Hand-written queries that live ALONGSIDE the DSL-generated queries.sql. entlite never touches this file, so anything here survives regeneration. These are queries the DSL query builder cannot express: cross-table JOINs, aggregates, and bulk maintenance operations.
The tables ("sensor", "reading") are defined in the generated schema.sql. Aggregate value statistics for a single sensor over a time window. Note: written as >= / <= rather than BETWEEN, because sqlc cannot infer the type of a DATETIME placeholder inside BETWEEN and silently drops it from the generated params struct.
func (*Queries) ListReadingBySensorId ¶
func (*Queries) ListReadingFilterBySensorIdRecordedAtFlagged ¶
func (*Queries) ListSensorFilterByLabelKindActive ¶
func (*Queries) ListSensorsWithLatestReading ¶
func (q *Queries) ListSensorsWithLatestReading(ctx context.Context, arg ListSensorsWithLatestReadingParams) ([]ListSensorsWithLatestReadingRow, error)
Every active sensor together with its most recent reading (LEFT JOIN, so sensors that have never reported still show up with NULL latest values). sqlc.embed(s) maps the joined sensor columns back to the full Sensor struct.
func (*Queries) PruneReadingsOlderThan ¶
Retention: drop readings older than a cutoff. Returns nothing.
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"`
}