dbcreator

package
v0.0.0-...-e036bea Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDatabase

func CreateDatabase(body string, filename string) error

CreateDatabase creates an sqlite3 database in the system temporary directory (/tmp on Linux) from the specified HTML data.

func ToYYYYMMDD

func ToYYYYMMDD(yymmdd string) string

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"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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