weather

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorOfInvalidCity = fmt.Errorf("暂不支持该城市或城市不存在")

Functions

This section is empty.

Types

type DailyData

type DailyData struct {
	Date            time.Time
	LowTemperature  int // 最低温度
	HighTemperature int // 最高温度
	Periods         []DetailedData
}

type DetailedData

type DetailedData struct {
	Time         time.Time
	Temperature  int    // 温度
	Weather      string // 天气状况
	WindClass    int    // 风力级别
	WindDirector string // 风向
}

type Weather

type Weather struct {
	City      string
	UpdatedAt time.Time
	Tips      []string    // 数条提示信息,每条为单行不超过15字,仅展示前10条
	Future    []DailyData // 未来的天气,Future[0]为今天
}

func FreeGetWeather

func FreeGetWeather(city string) (Weather, error)

FreeGetWeather 调用免费API获取天气数据

Jump to

Keyboard shortcuts

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