dbcompare

package
v0.66.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package dbcompare compares the schemas and complete rows of two DALgo databases. It keeps provider values lossless and delegates keyed row matching and field-delta classification to DALgo recordops.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DifferenceCounts

type DifferenceCounts struct {
	Added     int64 `json:"added"`
	Removed   int64 `json:"removed"`
	Changed   int64 `json:"changed"`
	Unchanged int64 `json:"unchanged"`
}

type FieldDiff

type FieldDiff struct {
	Name         string `json:"name"`
	Before       any    `json:"before"`
	After        any    `json:"after"`
	BeforeAbsent bool   `json:"beforeAbsent,omitempty"`
	AfterAbsent  bool   `json:"afterAbsent,omitempty"`
}

type Options

type Options struct {
	Details     bool
	DetailLimit int
	LeftSchema  string
	RightSchema string
	TableMaps   map[string]string
	KeyMaps     map[string][]string
}

type RecordDiff

type RecordDiff struct {
	ID     string      `json:"id"`
	Status string      `json:"status"`
	Fields []FieldDiff `json:"fields,omitempty"`
}

type RelationReport

type RelationReport struct {
	Name           string           `json:"name"`
	RightName      string           `json:"rightName,omitempty"`
	Kind           string           `json:"kind"`
	Identity       string           `json:"identity"`
	LeftRows       int64            `json:"leftRows"`
	RightRows      int64            `json:"rightRows"`
	Counts         DifferenceCounts `json:"counts"`
	Details        []RecordDiff     `json:"details,omitempty"`
	DetailsLimited bool             `json:"detailsLimited,omitempty"`
}

type Report

type Report struct {
	LeftName       string           `json:"leftName"`
	RightName      string           `json:"rightName"`
	SchemaChanges  []string         `json:"schemaChanges"`
	Warnings       []string         `json:"warnings,omitempty"`
	Relations      []RelationReport `json:"relations"`
	Summary        DifferenceCounts `json:"summary"`
	DetailsLimited bool             `json:"detailsLimited"`
}

func Compare

func Compare(ctx context.Context, leftName string, left dal.DB, rightName string, right dal.DB, options Options) (Report, error)

Compare compares the union of both relation inventories and reads every row from every common collection. DetailLimit affects only retained examples; it never stops reading either source.

Jump to

Keyboard shortcuts

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