digest

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const Separator = ","

Separator for CSV. Not configurable for now.

Variables

This section is empty.

Functions

func Create

func Create(config *Config) map[uint64]uint64

Create can create a Digest using the Configurations passed. It returns the digest as a map[uint64]uint64. It can also keep track of the Source line.

Types

type Config

type Config struct {
	Key    Positions
	Value  Positions
	Reader io.Reader
}

Config represents configurations that can be passed to create a Digest.

func NewConfig

func NewConfig(r io.Reader, primaryKey Positions, valueColumns Positions) *Config

NewConfig creates an instance of Config struct.

type Difference added in v1.0.0

type Difference struct {
	Additions     []string
	Modifications []string
}

Difference represents the additions and modifications between the two Configs

func Diff added in v1.0.0

func Diff(baseConfig, deltaConfig *Config) Difference

Diff will differentiate between two given configs

type Digest

type Digest struct {
	Key   uint64
	Value uint64
}

Digest represents the binding of the key of each csv line and the digest that gets created for the entire line

func CreateDigest

func CreateDigest(csv []string, pKey Positions, pRow Positions) Digest

CreateDigest creates a Digest for each line of csv. There will be one Digest per line

type Positions

type Positions []int

Positions represents positions of columns in a CSV array.

func (Positions) MapToValue

func (p Positions) MapToValue(csv []string) string

MapToValue plucks the values from CSV from their respective positions and concatenates them using Separator as a string.

Jump to

Keyboard shortcuts

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