diff

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Differ

func Differ(
	ctx context.Context,
	srcCh <-chan *Document,
	dstCh <-chan *Document,
) (<-chan Diff, <-chan error)

Differ compares the documents in the source index to those in the destination index. It returns the outcomes via a Diff structure, one by one.

Types

type Diff

type Diff struct {
	Mode Mode
	Src  *Document
	Dst  *Document
}

Diff is the outcome of comparing two documents in source and destination index.

type Document

type Document struct {
	ID     string                 `json:"_id,omitempty"`
	Source map[string]interface{} `json:"_source,omitempty"`
}

Document is a generic document retrieved from Elasticsearch.

type Mode

type Mode int

Mode describes the outcome of comparing two documents.

const (
	// Unchanged means that a document has not been changed between
	// source and destination index.
	Unchanged Mode = iota
	// Created means that a document has been added to the destination
	// that didn't exist in the source index.
	Created
	// Updated means that a document has been found both in the source
	// and destination index, but its contents (_source) has changed.
	Updated
	// Deleted means that a document has been found in the source index
	// but it doesn't exist in the destination index.
	Deleted
)

func (Mode) String

func (m Mode) String() string

Mode returns a string represenation for a mode.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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