csvdiff

package
v0.0.0-...-e08b29d Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package csvdiff implements a robust csv differ in go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsJSON

func AsJSON(fromCSV, toCSV io.Reader, opt *Options) (string, error)

AsJSON returns json represention of diffRef (with values).

func AsSummary

func AsSummary(fromCSV, toCSV io.Reader, opt *Options) (string, error)

AsSummary returns summary of the diff.

func OrderedSet

func OrderedSet(slices ...[]string) []string

OrderedSet returns a set from a slice

Types

type Comparator

type Comparator func(a, b string) bool

Comparator returns true if values in cell "a" and "b" are considered equal or false otherwise.

type DiffRef

type DiffRef struct {
	AddedRow, RemovedRow []string
	Changed              map[string][]string
}

DiffRef contains references to keys of changed records between two csvs

func Compare

func Compare(fromCSV, toCSV io.Reader, opt *Options) (DiffRef, error)

Compare returns the DiffRef between two csv files

type Options

type Options struct {
	IgnoreColumns, KeyColumns         []string
	IgnoreCase, LazyQuotes, HasHeader bool
	Separator                         rune
	Precision                         int
	Comparator                        Comparator
}

Options represents configuration for csv diff.

Jump to

Keyboard shortcuts

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