diff

package
v0.46.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package diff contains the CLI's diff implementation.

Reference: - https://github.com/aymanbagabas/go-udiff - https://www.gnu.org/software/diffutils/manual/html_node/Hunks.html - https://www.cloudbees.com/blog/git-diff-a-complete-comparison-tutorial-for-git

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecSourceDiff

func ExecSourceDiff(ctx context.Context, ru *run.Run, cfg *Config,
	elems *Elements, handle1, handle2 string,
) error

ExecSourceDiff diffs handle1 and handle2.

func ExecTableDiff

func ExecTableDiff(ctx context.Context, ru *run.Run, cfg *Config, elems *Elements,
	handle1, table1, handle2, table2 string,
) error

ExecTableDiff diffs handle1.table1 and handle2.table2.

func Print

func Print(w io.Writer, pr *output.Printing, header, dif string) error

Print prints dif to w. If pr is nil, printing is in monochrome.

Types

type Config

type Config struct {
	// Lines specifies the number of lines of context surrounding a diff.
	Lines int

	// RecordWriterFn is a factory function that returns
	// an output.RecordWriter used to generate diff text
	// when comparing table data.
	RecordWriterFn output.NewRecordWriterFunc
}

Config contains parameters to control diff behavior.

type Elements

type Elements struct {
	// Overview compares a summary of the sources.
	Overview bool

	// DBProperties compares DB properties.
	DBProperties bool

	// Schema compares table/schema structure.
	Schema bool

	// RowCount compares table row count when comparing schemata.
	RowCount bool

	// Data compares each row in a table. Caution: this can be slow.
	Data bool
}

Elements determines what source elements to compare.

Directories

Path Synopsis
internal
go-udiff
Package diff computes differences between text files or strings.
Package diff computes differences between text files or strings.
go-udiff/difftest
Package difftest supplies a set of tests that will operate on any implementation of a diff algorithm as exposed by diff "github.com/neilotoole/sq/cli/diff/internal/go-udiff"
Package difftest supplies a set of tests that will operate on any implementation of a diff algorithm as exposed by diff "github.com/neilotoole/sq/cli/diff/internal/go-udiff"
go-udiff/lcs
package lcs contains code to find longest-common-subsequences (and diffs)
package lcs contains code to find longest-common-subsequences (and diffs)
go-udiff/myers
Package myers implements the Myers diff algorithm.
Package myers implements the Myers diff algorithm.

Jump to

Keyboard shortcuts

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