Documentation ¶
Overview ¶
gas package includes data structures for service stations, such as their ID, address, and coordinates. It also holds information on available gases and prices, opening hours, automated services, and offerings provided by each station.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DataURL = "https://www.data.gouv.fr/fr/datasets/r/b0561905-7b5e-4f38-be50-df05708acb80"
DataURL is the URL to retrieve the price of each ful in each service station in France. It must points to a JSON-encoded file.
Functions ¶
This section is empty.
Types ¶
type Data ¶
type Data struct { // ID serves as a unique identifier for a service station, allowing it to be // distinguished from other locations or entities within a system or // database. ID int `json:"id"` // Coords refer to the geographic coordinates of a service station, which // consist of two values indicating its longitude and latitude respectively. Coords [2]float64 `json:"coords"` // Address refers to a location identifier that follows a specific format // consisting of the street number and street name. AddressRd string `json:"address_rd"` // Same as AddressRd but it contains the zip code, and city name. AddressCP string `json:"address_cp"` // Automate2424 indicates whether a service station is open 24/7 due to the // presence of an automated system, which allows customers to access // services even when the station is not staffed. Automate2424 bool `json:"automate_2424"` // Horaires refer to the specific opening and closing hours of a service // station on each day of the week. Horaires [7][][2]DataTime `json:"horaires"` // Services refer to a collection of different offerings that a business or // establishment provides to its customers, which may include products, // support, maintenance, or other types of assistance. Services []string `json:"services"` // Gas data structure contains information about the various types of gases // available at a service station, including the cost of each gas. Gas map[GasType]DataGas `json:"gas"` }
Data represents a service-station. It contains the coordinates, identifier, opening and closing hours.
func Fetch ¶
Fetch retrieves and decodes the JSON file available at the URL DataURL. It returns the list of stations and the price of each fuel.
func (*Data) UnmarshalJSON ¶
type DataGas ¶
DataGas is a type of data that contains information about a particular type of gas, including the time when its price was last updated and its cost per liter.
type DataTime ¶
DateTime refers to a specific time of day that includes only the hour and minute values.
type JSONFields ¶
type JSONFields struct { Fields struct { ID int `json:"id"` Geom [2]float64 `json:"geom"` Adresse string `json:"adresse"` // CP is the zip code. CP string `json:"cp"` Ville string `json:"ville"` // HorairesAutomate2424 is set to "Oui" when there is an automate // available 24/7. HorairesAutomate2424 string `json:"horaires_automate_24_24"` // Horaires are the shop/counter opening hours. The format is as follows: // // { // "@automate-24-24": "1", // "jour": [ // { // "@id": "1", // "@nom": "Lundi", // "@ferme": "", // "horaire": {"@ouverture": "08.30", "@fermeture": "19.00"} // }, // { // "@id": "2", // "@nom": "Lundi", // "@ferme": "1", // "horaire": [{"@ouverture": "08.30", "@fermeture": "19.00"}, {"@ouverture": "08.30", "@fermeture": "19.00"}] // }, // ] // } Horaires string `json:"horaires"` // ServiceService is a "//" separated list of services. ServicesService string `json:"services_service"` // CarburantsDisponibles is a ";" separated list of available fuels. CarburantsDisponibles string `json:"carburants_disponibles"` // GazoleMaj is the date of the latest update for the "Gazole" fuel. The // format is as follows: 2006-01-02 15:04:05. GazoleMaj string `json:"gazole_maj"` // GazolePrix is the price of the "Gazole" fuel in Euros. The format is // as follows: 1.02. GazolePrix string `json:"gazole_prix"` SP95Maj string `json:"sp95_maj"` SP95Prix string `json:"sp95_prix"` E85Maj string `json:"e85_maj"` E85Prix string `json:"e85_prix"` GPLcMaj string `json:"gplc_maj"` GPLcPrix string `json:"gplc_prix"` E10Maj string `json:"e10_maj"` E10Prix string `json:"e10_prix"` SP98Maj string `json:"sp98_maj"` SP98Prix string `json:"sp98_prix"` } `json:"fields"` }
JSONFields contain the useful JSON data for each station. This is used to decode the JSON file on the fly. A post-processing will then be done from this data.
type JSONHoraire ¶
type JSONHoraire []JSONOuverture
JSONHoraire hold the shop/counter opening hours for a specific day. This is used to decode the JSON file on the fly. A post-processing will then be done from this data.
func (*JSONHoraire) UnmarshalJSON ¶
func (h *JSONHoraire) UnmarshalJSON(data []byte) error
type JSONHoraires ¶
type JSONHoraires struct { // Automate2424 is set to "1" when there is an automate available 24/7. Automate2424 string `json:"@automate-24-24"` // Jour contain the opening hours for each day. Jour []struct { // ID of the day. For example: 1 = Monday. ID string `json:"@id"` // Ferme is set to "1" if it the shop/counter is closed. Ferme string `json:"@ferme"` // Horaire hold the opening hours for this day. Horaire JSONHoraire `json:"horaire"` } `json:"jour"` }
JSONHoraires hold the shop/counter opening hours. This is used to decode the JSON file on the fly. A post-processing will then be done from this data.
type JSONOuverture ¶
type JSONOuverture struct { // Ouverture is the opening hour. The format is as follows: 15.04. Ouverture string `json:"@ouverture"` // Fermeture is the closing hour. The format is as follows: 15.04. Fermeture string `json:"@fermeture"` }
JSONOuvertures contain the opening and closing hour of a single time slot. This is used to decode the JSON file on the fly. A post-processing will then be done from this data.