weatherwarnings

package module
v0.0.0-...-161623e Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

README

Weather Warnings Scraper

GitHub go.mod Go version GitHub Go Report Card Go Reference

Overview

weatherwarnings is a Go package that provides a utility for retrieving weather warnings from Met Éireann. It includes a function GetWarnings that returns a slice of Warning structs.

Installation

To use this package in your Go project, run:

go get -u github.com/JoeyTatu/weatherwarnings

Example usage:

package main

import (
	"fmt"
	"log"

	"github.com/JoeyTatu/weatherwarnings"
)

func main() {
	// Valid requests:
	// weatherwarnings.GetWarnings("today")
	// weatherwarnings.GetWarnings("tomorrow")
	// weatherwarnings.GetWarnings("dayAfterTomorrow")
	// weatherwarnings.GetWarnings() // defaults to "today"

	weatherWarnings, err := weatherwarnings.GetWarnings("today")
	if err != nil {
		log.Fatal(err)
	}

	// Print or use the warnings as needed
	for _, w := range weatherWarnings {
		fmt.Printf("Title: %s\n", w.Title)
		fmt.Printf("Description: %s\n", w.Description)
		fmt.Printf("Valid: %s\n", w.Valid)
		fmt.Printf("Issued: %s\n", w.Issued)
		fmt.Println("-----------")
	}
}

Documentation

Index

Constants

View Source
const Version = "v2024.1.21"

Variables

This section is empty.

Functions

This section is empty.

Types

type Warning

type Warning struct {
	Title       string
	Description string
	Valid       string
	Issued      string
}

func GetWarnings

func GetWarnings(day ...string) ([]Warning, error)

Jump to

Keyboard shortcuts

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