package db import ( "context" "github.com/Masterminds/semver" "github.com/go-flucky/flucky/pkg/types" ) type Database interface { // Close DB Connction Close() error // Schema Schema(ctx context.Context, version *semver.Version) error // Delete DeleteDevices(ctx context.Context, devices []*types.Device) error DeleteInfo(ctx context.Context, key string) error DeleteMeasuredValues(ctx context.Context, measuredValues []*types.MeasuredValue) error DeleteSensors(ctx context.Context, sensors []*types.Sensor) error // Insert InsertDevices(ctx context.Context, devices []*types.Device) error InsertInfo(ctx context.Context, key string, value string) error InsertMeasuredValues(ctx context.Context, measuredValues []*types.MeasuredValue) error InsertSensors(ctx context.Context, sensors []*types.Sensor) error // Select SelectDeviceByID(ctx context.Context, id string) (*types.Device, error) SelectHumidities(ctx context.Context) ([]*types.MeasuredValue, error) SelectHumidityByID(ctx context.Context, id string) (*types.MeasuredValue, error) SelectInfo(ctx context.Context, key string) (string, error) SelectMeasuredValues(ctx context.Context) ([]*types.MeasuredValue, error) SelectMeasuredValuesByIDAndType(ctx context.Context, id string, valueType types.MeasuredValueType) (*types.MeasuredValue, error) SelectPressures(ctx context.Context) ([]*types.MeasuredValue, error) SelectPressureByID(ctx context.Context, id string) (*types.MeasuredValue, error) SelectSensorByID(ctx context.Context, id string) (*types.Sensor, error) SelectTemperatures(ctx context.Context) ([]*types.MeasuredValue, error) SelectTemperatureByID(ctx context.Context, id string) (*types.MeasuredValue, error) // Update UpdateDevices(ctx context.Context, devices []*types.Device) error UpdateInfo(ctx context.Context, key string, value string) error UpdateMeasuredValues(ctx context.Context, measuredValues []*types.MeasuredValue) error UpdateSensors(ctx context.Context, sensots []*types.Sensor) error }