horzmerge

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2021 License: MIT Imports: 7 Imported by: 0

README

horzmerge

Package horzmerge merges columns from one or more streams of data.

Documentation

Contributing

License

MIT Licensed

© 2021 Parro's Go Packages

Documentation

Overview

Package horzmerge merges columns from one or more streams of data.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Merge

func Merge(opt Options, readers ...io.Reader) error

Merge read lines from all io.Reader in sources, and build an hash of columns for every reader, interpreting data with a tabular semantic.

All hashes created in this way are then merged into a single hash and saved in a tabular format again.

Example

This example show how to use horzmerge.Func()

package main

import (
	"embed"
	"io/fs"

	_ "github.com/parrogo/horzmerge"
)

//go:embed fixtures
var fixtureRootFS embed.FS
var fixtureFS, _ = fs.Sub(fixtureRootFS, "fixtures")

// This example show how to use horzmerge.Func()
func main() {
	//fmt.Println(horzmerge.Merge())
	

Types

type InputError

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

InputError wraps an error in order to include the position of failing stream.

func (InputError) Convert

func (e InputError) Convert(filenames []string) error

Convert returns an error that include the name of the file that causes the failure

func (InputError) Error

func (e InputError) Error() string

Error implements error interface

func (InputError) Unwrap

func (e InputError) Unwrap() error

Unwrap returns the wrapped error

type Options

type Options struct {
	Target io.Writer
	Empty  string
}

Options struct groups all options accepted by Merge.

Target field contains the io.Writer on which to write merged columns. When it's nil, os.Stdout is used as writer.

Empty field is a string that can be used to specify a value that will be interpreted as empty. When a cell of text contains this value (space trimmed), it cannot overwrite a previous value already set for the column, readed from one of the previous readers.

Directories

Path Synopsis
cli
horzmerge command

Jump to

Keyboard shortcuts

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