Documentation
¶
Overview ¶
Package processor contains built-in post-query processors for the query engine: sqlite-backed merge and key-based reconciliation. Each processor self-registers via init(); consumers enable them with a blank import:
import _ "github.com/flanksource/commons-db/query/processor"
Index ¶
Constants ¶
const ( ReconAdded = "added" ReconRemoved = "removed" ReconChanged = "changed" ReconUnchanged = "unchanged" // ReconStatusColumn holds the per-row reconciliation status. ReconStatusColumn = "_recon_status" // ReconChangesColumn holds a map of changed columns -> {from,to} for // rows with status "changed". ReconChangesColumn = "_recon_changes" )
Reconciliation status values written to the ReconStatusColumn.
Variables ¶
This section is empty.
Functions ¶
func Merge ¶
Merge loads each ResultSet into an in-memory SQLite database as a table, then runs mergeSQL (an arbitrary join/aggregation across those tables) and returns the resulting rows. Ported from duty/dataquery/sqlite.go.
func Recon ¶
Recon reconciles a target result set against a baseline, keyed by opts.Key. Each returned row is the target row (or the baseline row, for removals) plus a ReconStatusColumn of added/removed/changed/unchanged. Changed rows also carry a ReconChangesColumn mapping each differing column to {from, to}.
Pure logic — no database required.
Types ¶
type ReconOptions ¶
type ReconOptions struct {
// Key is the set of columns that uniquely identify a row across both sets.
Key []string
// Compare restricts which columns are compared for the "changed" status.
// When empty, all non-key columns present in either row are compared.
Compare []string
}
ReconOptions configures a reconciliation.