utils

package
v0.0.0-...-4db19ce Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2019 License: MIT Imports: 3 Imported by: 1

Documentation

Overview

Package utils holds common data structures and functions useful for working with OpenChirp.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatFloat64

func FormatFloat64(f float64) string

FormatFloat64 formats the given float64 value using a dynamic precison that looks cleaner when sent back to OpenChirp

func ParseCSVConfig

func ParseCSVConfig(configline string) ([]string, error)

ParseCSVConfig parses a single config field that follows comma and optional quotes seperated syntax into it's constituent tokens Possible errors returned are from the encoding/csv package. The error can be referenced by it's concrete type *csv.ParseError, which can give useful information about where the parse error occurred. Example: errColumn := err.(*csv.ParseError).Column

func ParseOCValue

func ParseOCValue(value string) interface{}

ParseOCValue tries to parse the three typical primitive data types used in OpenChirp. It first tries to parse the value as a float64. Then, it tries to parse as a bool. If all else fails, it returns the value as a string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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