sismo

package
v0.0.0-...-ef76487 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const BASE_URL = "http://sismologia.cl"
View Source
const DATE_FORMAT = "20060102"
View Source
const HISTORIC_URL = BASE_URL + "/sismicidad/catalogo/%04d/%02d/%04d%02d%02d.html"
View Source
const TABLE_SELECTOR = "table tr"

Variables

View Source
var Errors = map[ErrorCode]string{
	0:  "Información obtenida satisfactoriamente",
	10: "Error indeterminado al interpretar parámetro",
	11: "Parámetro Obligatorio event-date mal formado",
	12: "Parámetro Opcional magnitude mal formado",
	20: "Error indeterminado al interpretar información desde Sismología",
	21: "Sismología no contesta",
	22: "Sismología contesta, pero no entrega información interpretable",
}

Functions

func ParseEvents

func ParseEvents(response *Response, urls []string, c *gin.Context)

Types

type ErrorCode

type ErrorCode int

type Event

type Event struct {
	ID           string     `json:"id"`
	URL          string     `json:"url"`
	MapURL       string     `json:"map_url"`
	LocalDate    string     `json:"local_date"`
	UTCDate      string     `json:"utc_date"`
	Latitude     float64    `json:"latitude"`
	Longitude    float64    `json:"longitude"`
	Depth        float64    `json:"depth"`
	Magnitude    *Magnitude `json:"magnitude"`
	GeoReference string     `json:"geo_reference"`
}

type HistoricParser

type HistoricParser struct{}

func (*HistoricParser) GetRoute

func (bp *HistoricParser) GetRoute() string

func (*HistoricParser) Parse

func (bp *HistoricParser) Parse(c *gin.Context)

type Magnitude

type Magnitude struct {
	Value       float64 `json:"value"`
	MeasureUnit string  `json:"measure_unit"`
}

type RecentParser

type RecentParser struct{}

func (*RecentParser) GetRoute

func (bp *RecentParser) GetRoute() string

func (*RecentParser) Parse

func (bp *RecentParser) Parse(c *gin.Context)

type Response

type Response struct {
	StatusCode        ErrorCode `json:"status_code"`
	StatusDescription string    `json:"status_description"`
	Events            []Event   `json:"events"`
	Error             string    `json:"error,omitempty"`
}

func (*Response) SetStatus

func (br *Response) SetStatus(code ErrorCode)

Jump to

Keyboard shortcuts

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