Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var MaxHistory = 30
MaxHistory variable determines the maximum number of data points that will be saved for each service station in the database.
var Refresh = 30 * time.Minute
Refresh is a variable that determines how often the gas price data is fetched from the French government API.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API structure is the container for the fetched gas price data from the French government. It holds information such as the current price, the date and time of the latest update, and any other relevant metadata. This structure is used by the application to access and manipulate the gas price data.
func Start ¶
The Start function initializes an instance of the API structure and launches a goroutine to periodically refresh the gas price data from the French government API. This function takes in a logger to log any relevant information or errors and a path to the database to store the fetched data. Once called, the Start function will continue to run in the background, periodically refreshing the gas price data and storing it in the specified database. The initialized API instance is returned by this function and can be used by the application to access and manipulate the gas price data. Stop may be called to kill the launched goroutine.
func (*API) Handler ¶
The Handler function returns an http.Handler that can be used with the http package to handle incoming HTTP requests. The Handler function allows the application to expose the fetched gas price data over a network via HTTP and can be used to build a simple RESTful API for the gas price data."