diff

package
v1.46.2 Latest Latest
Warning

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

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

Documentation

Overview

Package diff contains code for things that can be diffed (e.g. namespaces and caveats).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiffableSchema

type DiffableSchema struct {
	// ObjectDefinitions holds the object definitions in the schema.
	ObjectDefinitions []*core.NamespaceDefinition

	// CaveatDefinitions holds the caveat definitions in the schema.
	CaveatDefinitions []*core.CaveatDefinition
}

DiffableSchema is a schema that can be diffed.

func NewDiffableSchemaFromCompiledSchema

func NewDiffableSchemaFromCompiledSchema(compiled *compiler.CompiledSchema) DiffableSchema

NewDiffableSchemaFromCompiledSchema creates a new DiffableSchema from a CompiledSchema.

func (*DiffableSchema) GetCaveat

func (ds *DiffableSchema) GetCaveat(caveatName string) (*core.CaveatDefinition, bool)

func (*DiffableSchema) GetNamespace

func (ds *DiffableSchema) GetNamespace(namespaceName string) (*core.NamespaceDefinition, bool)

func (*DiffableSchema) GetRelation

func (ds *DiffableSchema) GetRelation(nsName string, relationName string) (*core.Relation, bool)

type SchemaDiff

type SchemaDiff struct {
	// AddedNamespaces are the namespaces that were added.
	AddedNamespaces []string

	// RemovedNamespaces are the namespaces that were removed.
	RemovedNamespaces []string

	// AddedCaveats are the caveats that were added.
	AddedCaveats []string

	// RemovedCaveats are the caveats that were removed.
	RemovedCaveats []string

	// ChangedNamespaces are the namespaces that were changed.
	ChangedNamespaces map[string]namespace.Diff

	// ChangedCaveats are the caveats that were changed.
	ChangedCaveats map[string]caveats.Diff
}

SchemaDiff holds the diff between two schemas.

func DiffSchemas

func DiffSchemas(existing DiffableSchema, comparison DiffableSchema, caveatTypeSet *caveattypes.TypeSet) (*SchemaDiff, error)

DiffSchemas compares two schemas and returns the diff.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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