csvcompare

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: MIT Imports: 9 Imported by: 0

README

CSV Compare

Test codecov

Package csv-compare helper provide an API to process CSV files with the same structure (columns).

The process results in a list of unique rows, in reverse order.

You can compare 1 (deduplication) or more files.

Current capabilities

  • deduplication (self-comparing) : top row has the precedence
  • deduplication for n files
  • not revert: on most case we want to have a diff file in FIFO style, this is the default behaviour, but sometimes you do not want.

Installation

go get github.com/Climberdav/csv-compare

Documentation

Overview

Package **csv-compare** provides un API to compare 1 or more csv file with same structure in order to provide a diff list of unique rows Different option can be provided See documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(srcFile string, opts *Options, filesToCompare ...string) ([][]string, error)

Compare self or more files and returns a map of all unique lines. When used whi one file, returned finalSlice will have uniques rows When used with 2 or more files, if a line is present 2 files, line will not be in the result slice

Types

type Comma

type Comma int
const (
	COMMA Comma = iota
	SEMICOLON
	TAB
)

func (Comma) String

func (c Comma) String() rune

type Options

type Options struct {
	// contains filtered or unexported fields
}

func NewOptions

func NewOptions(headers bool) *Options

create a new Options, with Revert = true

func (*Options) HasHeader

func (o *Options) HasHeader()

header default value is false

func (*Options) NoRevert

func (o *Options) NoRevert()

func (*Options) SetComma

func (o *Options) SetComma(c rune)

func (*Options) SetIndexes

func (o *Options) SetIndexes(idxes ...int)

Jump to

Keyboard shortcuts

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