dsdiff

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: MIT Imports: 6 Imported by: 0

README

Qri GoDoc License Codecov CI Go Report Card

dsdiff

Utility for Diffing Datasets, currently a very basic placeholder

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffDatasets

func DiffDatasets(a, b *dataset.Dataset, deRefData *StructuredDataTuple) (map[string]*SubDiff, error)

DiffDatasets returns a map of pointers to diffs of the components of a dataset. It calls each of the Diff{Component} functions and adds the option for including de-referenced dataset.Data via the StructuredDataTuple TODO (kasey): This function only diffs: Structure, Meta, Transform, Viz, and Data (in JSON or as a Dataset)

func MapDiffsToString

func MapDiffsToString(m map[string]*SubDiff, how string) (string, error)

MapDiffsToString generates a string description from a map of diffs Currently the String generated reflects the first/highest priority change made. The priority of changes currently are

  1. dataset.Structure
  2. dataset.{Data}
  3. dataset.Transform
  4. dataset.Meta
  5. Dataset.Viz

Types

type StructuredDataTuple

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

StructuredDataTuple provides an additional input for DiffDatasets to use fully de-referenced dataset.data so that we can consider changes in dataset.Data beyond the hash/path being similar or different

type SubDiff

type SubDiff struct {
	jdiff.Diff
	// contains filtered or unexported fields
}

SubDiff holds the diffs of a Dataset Subcomponent diff

func DiffData

func DiffData(a, b *dataset.Dataset) (*SubDiff, error)

DiffData diffs the data of two datasets

func DiffJSON

func DiffJSON(a, b []byte, kind string) (*SubDiff, error)

DiffJSON diffs two json byte slices and returns a SubDiff pointer

func DiffMeta

func DiffMeta(a, b *dataset.Meta) (*SubDiff, error)

DiffMeta diffs the metadata of two datasets

func DiffStructure

func DiffStructure(a, b *dataset.Structure) (*SubDiff, error)

DiffStructure diffs the structure of two datasets

func DiffTransform

func DiffTransform(a, b *dataset.Transform) (*SubDiff, error)

DiffTransform diffs the transform struct of two datasets

func DiffViz

func DiffViz(a, b *dataset.Viz) (*SubDiff, error)

DiffViz diffs the dataset.Viz structs of two datasets

func (*SubDiff) MarshalJSON

func (d *SubDiff) MarshalJSON() ([]byte, error)

MarshalJSON marshals the slice of diffs from the SubDiff

func (*SubDiff) SummarizeToString

func (d *SubDiff) SummarizeToString(how string) (string, error)

SummarizeToString outputs a substring in a one of a few formats

  • simple (single line describing which component and how many changes)
  • listKeys (lists the keys of what changed)
  • plusMinusColor (git-style plus/minus printout)
  • plusMinus (same as plusMinusColor without color)

Jump to

Keyboard shortcuts

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