Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateDummyGradeNames ¶
GenerateDummyGradeNames generates dummy grade names in reverse alphabetical order
func ReadNamesRow ¶
ReadNamesRow reads a bunch of names as strings
func ReadNumber ¶
ReadNumber reads the number from the input string.
Types ¶
type ProfilesCsvReader ¶
type ProfilesCsvReader struct{}
ProfilesCsvReader reads a poll's tally in a CSV like so:
Nutriscore, G, F, E, D, C, B, A
Pizza, 4, 2, 3, 4, 5, 4, 1
Chips, 5, 3, 2, 4, 4, 3, 2
Pasta, 4, 4, 2, 4, 4, 3, 2
func (ProfilesCsvReader) Read ¶
func (r ProfilesCsvReader) Read(input *io.Reader) ( judgments [][]int, tallies [][]float64, proposals []string, grades []string, err error, )
Read the input CSV and return as much data as we can. Read does not fill the `judgments` because this data is absent from the profiles.
type Reader ¶
type Reader interface {
// Read the input into judgment and tally data, as well as poll metadata.
// Most outputs are allowed to be empty (nil?),
// but you must return at least either `tallies` or `judgments`.
Read(
input *io.Reader,
) (
judgments [][]int,
tallies [][]float64,
proposals []string,
grades []string,
err error,
)
}
Reader to implement to make another reader
Click to show internal directories.
Click to hide internal directories.