utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DistrictInfo

func DistrictInfo(jsonArray []byte, entity string, lastUpdated string) error

StateInfo prints stats about a district of a particular state.

func ExistsString

func ExistsString(items []string, key string) (string, bool)

ExistsString checks if a string is present in a slice of strings.

func ExtractDataPoints

func ExtractDataPoints(dataArray []json.RawMessage, key string) ([]float64, error)

ExtractDataPoints extracts the value of a particular key and returns a float64 slice.

func FormatDate

func FormatDate(date string) string

FormatDate handles the case of '/' being substituted with '\/'

func GetKeys

func GetKeys(jsonArray []byte) ([]string, error)

GetKeys returns the keys from a JSON string.

func GetSubJSON

func GetSubJSON(jsonArray []byte, key string) ([]byte, error)

GetSubJSON returns a byte array corresponding to a JSON key.

func ListEntities

func ListEntities(items []string, commandType string)

BeautifyIndexed prints a lsit of strings alphabetically and numerically indexed.

func PrintPlot

func PrintPlot(data []float64, plotData PlotData)

PrintPlot generates a graph and prints it onto the terminal.

func PullSike

func PullSike() error

PullSike chooses a different type of sike to pull everytime called.

func StateInfo

func StateInfo(jsonArray []byte) error

StateInfo prints stats about a state leaving out details on a per-district basis.

func TrimQuotes

func TrimQuotes(toTrim []byte) string

TrimQuotes removes enclosing quoates in a printable string

Types

type PlotData

type PlotData struct {
	XAxis   string
	YAxis   string
	Caption string
}

Jump to

Keyboard shortcuts

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