common

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: PostgreSQL Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CheckMark = "\u2714"
	CrossMark = "\u2718"
)

Variables

This section is empty.

Functions

func AddSpockMetadata

func AddSpockMetadata(row map[string]any) map[string]any

func ApplyDatabaseCredentials added in v1.4.0

func ApplyDatabaseCredentials(dst map[string]any, db types.Database)

ApplyDatabaseCredentials ensures the provided map has the database level connection details (user/password/ssl). Existing non-empty values are left untouched so node-specific overrides are preserved.

func CheckClusterExists

func CheckClusterExists(clusterName string) bool

func Contains

func Contains(slice []string, value string) bool

func ConvertToPgxType

func ConvertToPgxType(val any, pgType string) (any, error)

ConvertToPgxType converts a value from a JSON unmarshal to a type that pgx can handle

func DiffStringSlices

func DiffStringSlices(a, b []string) (missing, extra []string)

func IsKnownScalarType

func IsKnownScalarType(colType string) bool

func MapToOrderedMap

func MapToOrderedMap(m map[string]any, cols []string) types.OrderedMap

func OrderedMapToMap

func OrderedMapToMap(om types.OrderedMap) map[string]any

func ParseNodes

func ParseNodes(nodes any) ([]string, error)

func ReadClusterInfo

func ReadClusterInfo(t ClusterConfigProvider) error

func SafeCut

func SafeCut(s string, n int) string

func StringifyKey

func StringifyKey(row map[string]any, pkeyCols []string) (string, error)

func StringifyOrderedMapKey

func StringifyOrderedMapKey(row types.OrderedMap, pkeyCols []string) (string, error)

func StripSpockMetadata

func StripSpockMetadata(row map[string]any) map[string]any

func TranslateNodeOrigin added in v1.5.0

func TranslateNodeOrigin(raw any, nodeNames map[string]string) any

func WriteDiffReport

func WriteDiffReport(diffResult types.DiffOutput, schema, table, format string) (string, string, error)

Types

type ClusterConfigProvider

type ClusterConfigProvider interface {
	GetClusterName() string
	GetDBName() string
	SetDBName(string)
	GetNodes() string
	GetNodeList() []string
	SetNodeList([]string)
	SetDatabase(types.Database)
	GetClusterNodes() []map[string]any
	SetClusterNodes([]map[string]any)
}

type DiffResult

type DiffResult struct {
	Node1OnlyRows []types.OrderedMap
	Node2OnlyRows []types.OrderedMap
	ModifiedRows  []ModifiedRow
}

func CompareRowSets

func CompareRowSets(rows1, rows2 []types.OrderedMap, pkeyCols []string, dataCols []string) (DiffResult, error)

type ModifiedRow

type ModifiedRow struct {
	PKey      string
	Node1Data types.OrderedMap
	Node2Data types.OrderedMap
}

Jump to

Keyboard shortcuts

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