Documentation
¶
Overview ¶
Package diff provides APOC diff operations.
This package implements all apoc.diff.* functions for comparing and finding differences between nodes, relationships, and data structures.
Index ¶
- func Deep(value1, value2 interface{}) bool
- func Lists(list1, list2 []interface{}) map[string]interface{}
- func Merge(map1, map2 map[string]interface{}, strategy string) map[string]interface{}
- func Patch(original map[string]interface{}, diff *DiffResult) map[string]interface{}
- func Strings(str1, str2 string) []map[string]interface{}
- func Summary(diff *DiffResult) map[string]int
- type DiffResult
- type Node
- type Relationship
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Deep ¶
func Deep(value1, value2 interface{}) bool
Deep performs a deep comparison of two values.
Example:
apoc.diff.deep(value1, value2) => true/false
func Lists ¶
func Lists(list1, list2 []interface{}) map[string]interface{}
Lists compares two lists and returns differences.
Example:
apoc.diff.lists([1, 2, 3], [2, 3, 4]) => {added: [4], removed: [1], common: [2, 3]}
func Merge ¶
Merge merges two maps with conflict resolution.
Example:
apoc.diff.merge(map1, map2, 'prefer_new') => merged map
func Patch ¶
func Patch(original map[string]interface{}, diff *DiffResult) map[string]interface{}
Patch applies a diff patch to a map.
Example:
apoc.diff.patch(original, diff) => patched map
func Strings ¶
Strings compares two strings and returns character-level differences.
Example:
apoc.diff.strings('hello', 'hallo') => differences
func Summary ¶
func Summary(diff *DiffResult) map[string]int
Summary provides a summary of differences.
Example:
apoc.diff.summary(diff) => {added: 2, removed: 1, changed: 3}
Types ¶
type DiffResult ¶
type DiffResult struct {
Added map[string]interface{}
Removed map[string]interface{}
Changed map[string]interface{}
Unchanged map[string]interface{}
}
DiffResult represents the result of a diff operation.
func Maps ¶
func Maps(map1, map2 map[string]interface{}) *DiffResult
Maps compares two maps and returns differences.
Example:
apoc.diff.maps({a: 1}, {a: 2, b: 3}) => {added: {b: 3}, changed: {a: {old: 1, new: 2}}}
func Nodes ¶
func Nodes(node1, node2 *Node) *DiffResult
Nodes compares two nodes and returns differences.
Example:
apoc.diff.nodes(node1, node2) => {added: {...}, removed: {...}, changed: {...}}
func Relationships ¶
func Relationships(rel1, rel2 *Relationship) *DiffResult
Relationships compares two relationships and returns differences.
Example:
apoc.diff.relationships(rel1, rel2) => {added: {...}, removed: {...}, changed: {...}}