db

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: May 12, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetWeatherRecordFromDB

func GetWeatherRecordFromDB(ctx context.Context, db WeatherDB, location string) (models.WeatherRecord, error)

GetWeatherRecordFromDB retrieves weather data from the database

func ListLocationsFromDB

func ListLocationsFromDB(ctx context.Context, db WeatherDB) ([]string, error)

ListLocationsFromDB retrieves all available locations from the database

Types

type MockWeatherDB

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

MockWeatherDB is a mock implementation of the WeatherDB interface

func NewMockWeatherDB

func NewMockWeatherDB() *MockWeatherDB

NewMockWeatherDB creates a new mock weather database

func (*MockWeatherDB) ListLocations

func (db *MockWeatherDB) ListLocations(ctx context.Context) ([]string, error)

ListLocations returns a list of all available locations in the database

func (*MockWeatherDB) QueryWeather

func (db *MockWeatherDB) QueryWeather(ctx context.Context, location string) (models.WeatherRecord, error)

QueryWeather retrieves weather data for a location from the mock database

type WeatherDB

type WeatherDB interface {
	QueryWeather(ctx context.Context, location string) (models.WeatherRecord, error)
	ListLocations(ctx context.Context) ([]string, error)
}

WeatherDB is the interface for weather database operations

Jump to

Keyboard shortcuts

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