recorddiff

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeSet

type ChangeSet struct {
	Type       string                   `json:"type"`
	Timestamp  string                   `json:"timestamp"`
	Added      []map[string]interface{} `json:"added,omitempty"`
	Deleted    []string                 `json:"deleted,omitempty"`
	Modified   []RecordChange           `json:"modified,omitempty"`
	TotalCount int                      `json:"total_count"`
	KeyField   string                   `json:"key_field"`
	Raw        bool                     `json:"raw"`
}

ChangeSet is the shared incremental payload used by the WebSocket server, CLI watch webhooks, and command sinks.

func Between

func Between(previous, current []map[string]interface{}, keyField string, at time.Time) ChangeSet

Between compares two transformed snapshots using keyField. It never mutates either input and keeps record ordering stable while sorting changed fields.

func (ChangeSet) Counts

func (changes ChangeSet) Counts() (added, modified, deleted int)

func (ChangeSet) Empty

func (changes ChangeSet) Empty() bool

func (ChangeSet) Map

func (changes ChangeSet) Map() map[string]interface{}

Map preserves the map-shaped WebSocket payload used by existing clients.

type RecordChange

type RecordChange struct {
	Code          string                 `json:"code"`
	ChangeType    string                 `json:"change_type"`
	OldValues     map[string]interface{} `json:"old_values,omitempty"`
	NewValues     map[string]interface{} `json:"new_values,omitempty"`
	ChangedFields []string               `json:"changed_fields,omitempty"`
	Record        map[string]interface{} `json:"record,omitempty"`
}

RecordChange describes one modified record while preserving the legacy WebSocket fields and carrying the complete new record for downstream sinks.

Jump to

Keyboard shortcuts

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