db

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 InsertReadingParams

type InsertReadingParams struct {
	ID         string
	SensorID   string
	Value      float64
	Unit       string
	RecordedAt string
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) GetReading

func (q *Queries) GetReading(ctx context.Context, id string) (Reading, error)

func (*Queries) InsertReading

func (q *Queries) InsertReading(ctx context.Context, arg InsertReadingParams) error

func (*Queries) ListReadings

func (q *Queries) ListReadings(ctx context.Context) ([]Reading, error)

func (*Queries) ListReadingsBySensor

func (q *Queries) ListReadingsBySensor(ctx context.Context, sensorID string) ([]Reading, error)

func (*Queries) WithTx

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

type Reading

type Reading struct {
	ID         string
	SensorID   string
	Value      float64
	Unit       string
	RecordedAt string
}

Jump to

Keyboard shortcuts

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