Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDatabase ¶
CreateDatabase creates an sqlite3 database in the system temporary directory (/tmp on Linux) from the specified HTML data.
func ToYYYYMMDD ¶
ToYYYYMMDD reformats the date string from yymmdd to YYYY-MM-DD
Types ¶
type AnswerData ¶
type AnswerData struct { Date string `json:"date"` Index string `json:"index"` Answer string `json:"answer"` }
func GetScrapes ¶
func GetScrapes(body string) []AnswerData
GetScrapes extracts the answer data from the specified string. This data is in JSON-like format following the string "pastData:". JSON-like because it is not quite valid JSON for two reasons:
1. The property names are not quoted.
2. The index field is almost always numeric, but there are several places where it is unquoted alphabetic data.
So after the JSON string is extracted, I pre-process the property names and index values to make them quoted.
type MonthData ¶
type MonthData struct { Month string `json:"month"` Answers []AnswerData `json:"answers"` }
Click to show internal directories.
Click to hide internal directories.