delta

package module
v0.0.0-...-583619b Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2014 License: MIT Imports: 3 Imported by: 0

README

go-diff

A (soon to be) collection of helper functions to determine the deltas of various Go "objects"

Usage

	import "github.com/jsimnz/go-delta"
    
    ..
    
	type someStruct struct {
    	Field1 string
        Field2 string
        Field3 int
    }
    
    ...
    
	val1 := someStruct{Field1: "Hello"}
    val2 := someStruct{Field1: "World"}
    
    diff, err := delta.Struct(val1, val2) // returns the delta (difference) between the 2 structs as a map
    
    // returns: 
    //	map[string]interface{}{
    //	   "Field1": "World",
    //    }
    // 
    // Which tells us that the second struct differs from the first by the field 'Field1',
    // and the new value is "World"
More delta functions to come...

Documentation

GoDoc: http://godoc.org/github.com/jsimnz/go-delta

Todo

  • More tests!

Author

John-Alan Simmons

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotStruct = errors.New("The given type is not a struct")
	WarnDiffType = errors.New("Warning given types are not of the same type")
)

Functions

func Struct

func Struct(base, compare interface{}) (map[string]interface{}, error)

Find the delta between 2 structs

Types

This section is empty.

Jump to

Keyboard shortcuts

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