Documentation
¶
Overview ¶
datatools package is a collection of Go based command line tools for working with JSON content
@Author R. S. Doiel, <rsdoiel@caltech.edu>
Copyright (c) 2017, Caltech All rights not granted herein are expressly reserved by Caltech.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Index ¶
- Constants
- func ApplyStopWords(fields []string, stopWords []string) []string
- func CSVMarshal(fields []string) ([]byte, error)
- func Filter(c rune, allowableCharacters string, allowPunctuation bool) bool
- func Levenshtein(src string, target string, insertCost int, deleteCost int, substituteCost int, ...) int
- func NormalizeDelimiter(s string) string
- func Text2Fields(r *bufio.Reader, options *Options) ([]byte, error)
- type Options
Constants ¶
const ( Version = "v0.0.7" LicenseText = `` /* 1530-byte string literal not displayed */ // Constants for datatools functions AsDelimited = iota AsCSV = iota AsJSON = iota )
Variables ¶
This section is empty.
Functions ¶
func ApplyStopWords ¶ added in v0.0.7
ApplyStopWords takes a list of words (array of strings) and removes any occurrences of the stop words return a revised list of words.
func CSVMarshal ¶ added in v0.0.7
CSVMarshal takes a list of strings and returns a byte array of CSV formated output.
func Filter ¶ added in v0.0.7
Filter filters out characters from string. By default it allows letters and numbers through with options for allow punctuation and other specific characters. Returns true if matches filter, false otherwise
func Levenshtein ¶ added in v0.0.7
func Levenshtein(src string, target string, insertCost int, deleteCost int, substituteCost int, caseSensitive bool) int
Levenshtein does a fuzzy match on two strings.
func NormalizeDelimiter ¶ added in v0.0.7
NormalizeDelimiters handles the messy translation from a format string recieved as an option in the cli to something useful to pass to Join.
Types ¶
Directories
¶
Path | Synopsis |
---|---|
cmds
|
|
csv2json
csv2json - is a command line that takes CSV input from stdin and writes out JSON expression.
|
csv2json - is a command line that takes CSV input from stdin and writes out JSON expression. |
csv2mdtable
csv2mdtable - is a command line that takes CSV input from stdin and writes out a Github Flavored Markdown table.
|
csv2mdtable - is a command line that takes CSV input from stdin and writes out a Github Flavored Markdown table. |
csv2xlsx
csv2xlsx is a command line utility that will convert a CSV file and insert it into a named sheet in an Excel Workbook.
|
csv2xlsx is a command line utility that will convert a CSV file and insert it into a named sheet in an Excel Workbook. |
csvcols
csvcols - is a command line that takes each argument in order and outputs a line in CSV format.
|
csvcols - is a command line that takes each argument in order and outputs a line in CSV format. |
csvfind
csvfind - is a command line that takes CSV files in returns the rows that match a column value.
|
csvfind - is a command line that takes CSV files in returns the rows that match a column value. |
csvjoin
csvjoin - is a command line that takes two CSV files and joins them by match a designated column in each.
|
csvjoin - is a command line that takes two CSV files and joins them by match a designated column in each. |
jsoncols
jsoncols is a command line tool for filter JSON data from standard in or specified files.
|
jsoncols is a command line tool for filter JSON data from standard in or specified files. |
jsonrange
jsonrange iterates over an array or map returning either a JSON expression or map keep to stdout @Author R. S. Doiel, <rsdoiel@caltech.edu>
|
jsonrange iterates over an array or map returning either a JSON expression or map keep to stdout @Author R. S. Doiel, <rsdoiel@caltech.edu> |
xlsx2csv
xlsx2csv.go is a command line utility that converts individual Excel Workbook Sheets to CSV.
|
xlsx2csv.go is a command line utility that converts individual Excel Workbook Sheets to CSV. |
xlsx2json
xlsx2json.go is a command line utility that converts an Excel Workboom Sheet into JSON.
|
xlsx2json.go is a command line utility that converts an Excel Workboom Sheet into JSON. |
dotpath.go package provides a convient way of mapping JSON dot path notation to a nested map structure.
|
dotpath.go package provides a convient way of mapping JSON dot path notation to a nested map structure. |