Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoASCIIString = &FormatError{Wrapping: errors.New("the given string has non-ASCII characters")} ErrMETARIncomplete = &FormatError{Wrapping: errors.New("the METAR is incomplete (end of string reached before time was found)")} ErrInvalidMETARTime = &FormatError{Wrapping: errors.New("the METAR's issuing time is formatted incorrectly (expected 'ddddddZ')")} )
Functions ¶
This section is empty.
Types ¶
type FormatError ¶
FormatError represents an error in a METAR format
func (*FormatError) Error ¶
func (err *FormatError) Error() string
type METAR ¶
type METAR struct {
ID uuid.UUID `json:"id"`
StationID string `json:"station_id"`
IssuedAt int64 `json:"issued_at"`
Raw string `json:"raw"`
}
METAR represents a stored METAR data point
type Repository ¶
type Repository interface {
// GetByFilter retrieves multiple METARs following a filter, ordered by their issuing date (descending).
// If limit <= 0, a default limit value of 10 is used.
GetByFilter(ctx context.Context, filter *Filter, limit uint64) ([]*METAR, uint64, error)
// GetByID retrieves a METAR by its ID
GetByID(ctx context.Context, id uuid.UUID) (*METAR, error)
// Create creates new METARs based on their raw text representation.
// All raw strings are sanitized (leading and trailing spaces are trimmed).
// This method also returns the indexes of the METARs that already exist in the database and thus were not inserted.
Create(ctx context.Context, raw []string) ([]*METAR, []uint, error)
// Delete deletes a METAR by its ID
Delete(ctx context.Context, id uuid.UUID) error
}
Repository defines the METAR repository API
Click to show internal directories.
Click to hide internal directories.