analysis

package
v0.0.0-...-cb2c959 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedSchemaType = fmt.Errorf("analysis: unsupported schema type")

ErrUnsupportedSchemaType is returned when a schema is given that is unsupported by average.

Functions

func CompliantData

func CompliantData(schema Schema, data Data) bool

CompliantData returns whether the given data complies to the schema. If the data has a field that is in the schema but does not match the type specified in the schema, then it is considered invalid. If there is a field in the data that is missing, (is present in the schema but not in the data), the data is still considered valid. If there is a field in the schema that is missing, but is present in the data, the data is still considered valid.

Types

type Data

type Data map[string]interface{}

Data provides a type for data, a map of key names to their values.

type Results

type Results map[string]float64

Results provides a type for analysis results, a map of key names to the results (ex. averages).

func Average

func Average(schema Schema, data ...Data) (Results, error)

Average averages all "number" and "bool" fields. True is considered 1, and false is considered zero.

type Schema

type Schema map[string]string

Schema defines a type for a schema, a mapping of key names to their types. Types supported are: "number", and "bool".

Jump to

Keyboard shortcuts

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