delta

package
v0.0.0-...-27c1981 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: ISC Imports: 4 Imported by: 0

Documentation

Overview

Package delta provides functions to create "deltas" between two sets, which consist of add and remove operations to make a second set contain the same items as the first set.

Within github2omnifocus, this is used to create the operations that bring the task list state in the local tool, Omnifocus, into line with the desired state from GitHub.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Keyed

type Keyed interface {
	Key() string
	GetTags() iter.Seq[string]
}

Keyed provides the Key function which is used by the Delta function to identify items uniquely.

type Operation

type Operation struct {
	Item Keyed
	Type OperationType
}

A Operation states that Item should be added or removed from a set.

func Delta

func Delta[D Keyed, C Keyed](desired map[string]D, current map[string]C, ignoreTags []string) []Operation

Delta returns a slice of DeltaOperations that, when applied to current, will result in current containing the same items as desired.

type OperationType

type OperationType int

OperationType states whether a DeltaOperation is add or remove.

const (
	Add OperationType = iota + 1
	Remove
)

func (OperationType) String

func (op OperationType) String() string

Jump to

Keyboard shortcuts

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