models

package
v0.0.0-...-5298318 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExtendedTideResponse

type ExtendedTideResponse struct {
	ResponseType          string           `json:"responseType"`
	Timestamp             int64            `json:"timestamp"`
	LocalTime             string           `json:"localTime"` // Add this field
	WaterLevel            *float64         `json:"waterLevel"`
	PredictedLevel        *float64         `json:"predictedLevel"`
	NearestStation        string           `json:"nearestStation"`
	Location              *string          `json:"location"`
	Latitude              float64          `json:"latitude"`
	Longitude             float64          `json:"longitude"`
	StationDistance       float64          `json:"stationDistance"`
	TideType              *TideType        `json:"tideType"`
	CalculationMethod     string           `json:"calculationMethod"`
	Extremes              []TideExtreme    `json:"extremes"`
	Predictions           []TidePrediction `json:"predictions"`
	TimeZoneOffsetSeconds *int             `json:"timeZoneOffsetSeconds"`
}

ExtendedTideResponse represents the full tide response including predictions and extremes

func (*ExtendedTideResponse) Validate

func (r *ExtendedTideResponse) Validate() error

Validate checks if an ExtendedTideResponse's fields are valid

type NoaaPrediction

type NoaaPrediction struct {
	Time   string  `json:"t"`              // Time of prediction
	Height string  `json:"v"`              // Predicted water level
	Type   *string `json:"type,omitempty"` // Type of prediction (H for high, L for low)
}

NoaaPrediction represents the raw NOAA API prediction response

type NoaaResponse

type NoaaResponse struct {
	Predictions []NoaaPrediction `json:"predictions"`
	Error       *struct {
		Message string `json:"message"`
	} `json:"error,omitempty"`
}

type Source

type Source string
const (
	SourceNOAA Source = "NOAA"
	SourceUKHO Source = "UKHO"
	SourceCHS  Source = "CHS"
)

type Station

type Station struct {
	ID             string   `json:"id"`
	Name           string   `json:"name"`
	State          *string  `json:"state,omitempty"`
	Region         *string  `json:"region,omitempty"`
	Distance       float64  `json:"distance"`
	Latitude       float64  `json:"latitude"`
	Longitude      float64  `json:"longitude"`
	Source         Source   `json:"source"`
	Capabilities   []string `json:"capabilities"`
	TimeZoneOffset int      `json:"timeZoneOffset"`
	Level          *string  `json:"level,omitempty"`
	StationType    *string  `json:"stationType,omitempty"`
}

func (*Station) Validate

func (s *Station) Validate() error

Validate checks if a Station's fields are valid

type StationFinder

type StationFinder interface {
	FindStation(ctx context.Context, stationID string) (*Station, error)
	FindNearestStations(ctx context.Context, lat, lon float64, limit int) ([]Station, error)
}

type TideExtreme

type TideExtreme struct {
	Type      TideType `json:"type"`
	Timestamp int64    `json:"timestamp"`
	LocalTime string   `json:"localTime"`
	Height    float64  `json:"height"`
}

TideExtreme represents a high or low tide

func (*TideExtreme) Validate

func (te *TideExtreme) Validate() error

Validate checks if a TideExtreme's fields are valid

type TidePrediction

type TidePrediction struct {
	Timestamp int64   `json:"timestamp"`
	LocalTime string  `json:"localTime"`
	Height    float64 `json:"height"`
}

TidePrediction represents a tide prediction at a specific time

func (TidePrediction) GetTimestamp

func (tp TidePrediction) GetTimestamp() int64

func (*TidePrediction) Validate

func (tp *TidePrediction) Validate() error

Validate checks if a TidePrediction's fields are valid

type TidePredictionRecord

type TidePredictionRecord struct {
	StationID   string           `dynamodbav:"stationId"`
	Date        string           `dynamodbav:"date"`
	StationType string           `dynamodbav:"stationType"` // R for reference, S for subordinate
	Predictions []TidePrediction `dynamodbav:"predictions"`
	Extremes    []TideExtreme    `dynamodbav:"extremes"`
	LastUpdated int64            `dynamodbav:"lastUpdated"`
	TTL         int64            `dynamodbav:"ttl"`
}

models.TidePredictionRecord represents a cached set of predictions for a station and date

func (*TidePredictionRecord) Validate

func (r *TidePredictionRecord) Validate() error

Validate checks if a TidePredictionRecord's fields are valid

type TideType

type TideType string
const (
	TideTypeRising TideType = "RISING"
	TideFalling    TideType = "FALLING"
	TideTypeHigh   TideType = "HIGH"
	TideTypeLow    TideType = "LOW"
)

Jump to

Keyboard shortcuts

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