pick

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2020 License: MIT Imports: 7 Imported by: 0

README

Pick: A library and simple tool for reordering and hashing tabular data

See poseur.com/pick/cmd/pick for a simple demonstration of this package.

Documentation

Overview

Package pick implements a simple library for reordering and hashing columnar data.

Use poseur.com/pick to transform an array of strings into another array of strings. The Do() function takes a row of data (a string array and an output column specification (an array of Column structs) and returns a string array of the same length as the column specification, with each element corresponding to the column specification at that index. Each column specification consists of an input field offset (zero-based) and an output specifier (a string corresponding to one of the supported output functions).

Index

Constants

View Source
const (

	// Plain does not modify the input.
	Plain = Hash("plain")

	// MD5 MD5-encodes the input and output lowercase hex signature.
	MD5 = Hash("md5")
	// SHA1 SHA1-encodes the input and output lowercase hex signature.
	SHA1 = Hash("sha1")
	// SHA256 SHA256-encodes the input and output lowercase hex signature.
	SHA256 = Hash("sha256")

	// UCMD5 MD5-encodes the input and output lowercase hex signature.
	UCMD5 = Hash("MD5") // MD5 the input (uppercase).
	// UCSHA1 SHA1-encodes the input and output lowercase hex signature.
	UCSHA1 = Hash("SHA1") // SHA1 the input (uppercase).
	// UCSHA256 SHA256-encodes the input and output lowercase hex signature.
	UCSHA256 = Hash("SHA256") // SHA256 the inpit (uppercase).
)

Variables

This section is empty.

Functions

func Do

func Do(row []string, columns []Column) ([]string, error)

Do picks and collects the specified fields of row, encoding them according to the Output method specified in each Column struct in columns.

Types

type Column

type Column struct {
	N      int  // Source field of input (zero-based).
	Output Hash // Output hash function.
}

Column represents an output column.

type Hash

type Hash string

Hash represents an output hash function specifier.

Source Files

  • pick.go

Directories

Path Synopsis
cmd
pick command

Jump to

Keyboard shortcuts

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