deep

package module
v3.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

README

Deep: High-Performance Data Manipulation for Go

deep is a high-performance, reflection-based engine for manipulating complex Go data structures. It provides recursive deep copying, semantic equality checks, and structural diffing to produce optimized patches.

V3 is designed for high-throughput applications, featuring a zero-allocation diffing engine and tag-aware operations.

Installation

go get github.com/brunoga/deep/v3

Core Features

1. Deep Copy

Justification: Standard assignment in Go performing shallow copies. deep.Copy creates a completely decoupled clone, correctly handling pointers, slices, maps, and private fields (via unsafe).

dst, err := deep.Copy(src)
  • Recursive: Clones the entire object graph.
  • Cycle Detection: Safely handles self-referencing structures.
  • Unexported Fields: Optionally clones private struct fields.
  • Example: Config Management
2. Semantic Equality (Equal[T])

Justification: reflect.DeepEqual is slow and lacks control. deep.Equal is a tag-aware, cache-optimized replacement that is up to 30% faster and respects library-specific struct tags.

if deep.Equal(objA, objB) {
    // Logically equal, respecting deep:"-" tags
}
  • Tag Awareness: Skips fields marked with deep:"-".
  • Short-Circuiting: Immediately returns true for identical pointer addresses.
  • Performance: Uses a global reflection cache to minimize lookup overhead.
3. Structural Diff & Patch

Justification: Efficiently synchronizing state between nodes or auditing changes requires knowing what changed, not just that something changed. deep.Diff produces a semantic Patch representing the minimum set of operations to transform one value into another.

// Generate patch
patch := deep.Diff(oldState, newState)

// Inspect changes
fmt.Println(patch.Summary()) 

// Apply to target
err := patch.ApplyChecked(&oldState)
  • Move & Copy Detection: Identifies relocated values to minimize patch size.
  • Three-Way Merge: Merges independent patches with conflict detection.
  • JSON Standard: Native export to RFC 6902 (JSON Patch).
  • Examples: Move Detection, Three-Way Merge

Advanced Capabilities

Conflict Resolution & CRDTs

Justification: In distributed systems, state often diverges. deep provides first-class support for state convergence using Hybrid Logical Clocks (HLC).

  • LWW Resolver: Automatic "Last-Write-Wins" resolution at the field level.
  • Example: CRDT Synchronization
Struct Tag Control

Fine-grained control over library behavior:

  • deep:"-": Completely ignore field.
  • deep:"key": Identity field for slice alignment (Myers' Diff).
  • deep:"readonly": Field can be diffed but not modified by patches.
  • deep:"atomic": Treat complex fields as scalar values.

Performance Optimization

v3.0 is built for performance-critical hot paths:

  • Zero-Allocation Engine: Uses sync.Pool for internal transient structures.
  • Lazy Allocation: Maps and slices in patches are only allocated if changes are found.
  • Manual Release: Use patch.Release() to return patch resources to the pool.

Version History

v1.0.0: The Foundation
  • Initial recursive Deep Copy implementation.
  • Basic Deep Diff producing Add/Remove/Replace operations.
  • Support for standard Go types (Slices, Maps, Structs, Pointers).
v2.0.0: Synchronization & Standards
  • JSON Pointer (RFC 6901): Standardized all path navigation.
  • Keyed Slice Alignment: Integrated identity-based matching into Myers' Diff.
  • Human-Readable Summaries: Added Patch.Summary() for audit logging.
  • HLC & CRDT: Introduced Hybrid Logical Clocks and LWW conflict resolution.
  • Multi-Error Reporting: ApplyChecked reports all validation failures at once.
v3.0.0: High-Performance Engine (Current)
  • Zero-Allocation Engine: Comprehensive refactor to use object pooling and path stacks.
  • deep.Equal[T]: High-performance, tag-aware replacement for reflect.DeepEqual.
  • Move & Copy Detection: Semantic detection of relocated values during Diff.
  • Custom Type Registry: Support for registering specialized diffing logic for external types.
  • Pointer Identity Optimization: Massive speedup via immediate short-circuiting for identical pointers.
  • Memory Efficiency: Up to 80% reduction in memory overhead for large structural comparisons.

License

Apache 2.0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConditionSkipped = fmt.Errorf("condition skipped")

Functions

func Copy

func Copy[T any](src T, opts ...CopyOption) (T, error)

Copy creates a deep copy of src. It returns the copy and a nil error in case of success and the zero value for the type and a non-nil error on failure.

It correctly handles cyclic references and unexported fields.

func Equal

func Equal[T any](a, b T) bool

Equal performs a deep equality check between a and b.

Unlike reflect.DeepEqual, this function: 1. Respects `deep:"-"` struct tags. 2. Uses the library's internal reflection cache for faster struct traversal. 3. Optimized for common Go types using Generics to reduce interface allocations at the entry point.

func IgnorePath

func IgnorePath(path string) interface {
	DiffOption
	CopyOption
}

IgnorePath returns an option that tells both Diff and Copy to ignore changes at the specified path. The path should use Go-style notation (e.g., "Field.SubField", "Map.Key", "Slice[0]").

func JoinPath

func JoinPath(parent, child string) string

JoinPath joins two JSON Pointer paths with a slash.

func Merge

func Merge[T any](patchA, patchB Patch[T]) (Patch[T], []Conflict, error)

Merge combines two patches into a single patch. If both patches modify the same field to different values, a conflict is recorded. patchA and patchB are assumed to be derived from the same base state.

func MustCopy

func MustCopy[T any](src T, opts ...CopyOption) T

MustCopy creates a deep copy of src. It returns the copy on success or panics in case of any failure.

It correctly handles cyclic references and unexported fields.

func NormalizePath

func NormalizePath(path string) string

NormalizePath converts a dot-notation or JSON Pointer path to a standard JSON Pointer.

func Register

func Register[T any]()

Register registers the Patch implementation for type T with the gob package. This is required if you want to use Gob serialization with Patch[T].

func RegisterCustomDiff

func RegisterCustomDiff[T any](d *Differ, fn func(a, b T) (Patch[T], error))

RegisterCustomDiff registers a custom diff function for a specific type.

func RegisterCustomPatch added in v3.1.1

func RegisterCustomPatch(kind string, p any)

RegisterCustomPatch registers a custom patch implementation for serialization. The provided patch instance is used to determine the type.

func ValueEqual

func ValueEqual(a, b reflect.Value) bool

ValueEqual performs a deep equality check between two reflect.Values. It is the internal engine for Equal and respects the same rules.

Types

type AndCondition

type AndCondition[T any] struct {
	Conditions []Condition[T]
}

AndCondition represents a logical AND of multiple conditions.

func (AndCondition[T]) Evaluate

func (c AndCondition[T]) Evaluate(v *T) (bool, error)

func (AndCondition[T]) MarshalJSON

func (c AndCondition[T]) MarshalJSON() ([]byte, error)

type ApplyError

type ApplyError struct {
	Errors []error
}

ApplyError represents one or more errors that occurred during patch application.

func (*ApplyError) Error

func (e *ApplyError) Error() string

func (*ApplyError) Unwrap

func (e *ApplyError) Unwrap() []error

type Builder

type Builder[T any] struct {
	// contains filtered or unexported fields
}

Builder allows constructing a Patch[T] manually with on-the-fly type validation.

func NewBuilder

func NewBuilder[T any]() *Builder[T]

NewBuilder returns a new Builder for type T.

func (*Builder[T]) AddCondition

func (b *Builder[T]) AddCondition(expr string) *Builder[T]

AddCondition parses a string expression and attaches it to the appropriate node in the patch tree based on the paths used in the expression. It finds the longest common prefix of all paths in the expression and navigates to that node before attaching the condition.

func (*Builder[T]) Build

func (b *Builder[T]) Build() (Patch[T], error)

Build returns the constructed Patch or an error if any operation was invalid.

func (*Builder[T]) Root

func (b *Builder[T]) Root() *Node

Root returns a Node representing the root of the value being patched.

type CompareCondition

type CompareCondition[T any] struct {
	Path       Path
	Val        any
	Op         string
	IgnoreCase bool
}

CompareCondition represents a comparison between a path and a literal value.

func (CompareCondition[T]) Evaluate

func (c CompareCondition[T]) Evaluate(v *T) (bool, error)

func (CompareCondition[T]) MarshalJSON

func (c CompareCondition[T]) MarshalJSON() ([]byte, error)

type CompareFieldCondition

type CompareFieldCondition[T any] struct {
	Path1      Path
	Path2      Path
	Op         string
	IgnoreCase bool
}

CompareFieldCondition represents a comparison between two paths.

func (CompareFieldCondition[T]) Evaluate

func (c CompareFieldCondition[T]) Evaluate(v *T) (bool, error)

func (CompareFieldCondition[T]) MarshalJSON

func (c CompareFieldCondition[T]) MarshalJSON() ([]byte, error)

type Condition

type Condition[T any] interface {
	// Evaluate evaluates the condition against the given value.
	Evaluate(v *T) (bool, error)

	// MarshalJSON returns the JSON representation of the condition.
	MarshalJSON() ([]byte, error)
	// contains filtered or unexported methods
}

Condition represents a logical check against a value of type T.

func And

func And[T any](conds ...Condition[T]) Condition[T]

And returns a condition that represents a logical AND of multiple conditions.

func Contains

func Contains[T any](path, val string) Condition[T]

Contains returns a condition that checks if the string value at the path contains the given substring.

func ContainsFold

func ContainsFold[T any](path, val string) Condition[T]

ContainsFold returns a condition that checks if the string value at the path contains the given substring (case-insensitive).

func Defined

func Defined[T any](path string) Condition[T]

Defined returns a condition that checks if the value at the path is defined.

func EndsWith

func EndsWith[T any](path, val string) Condition[T]

EndsWith returns a condition that checks if the string value at the path ends with the given suffix.

func EndsWithFold

func EndsWithFold[T any](path, val string) Condition[T]

EndsWithFold returns a condition that checks if the string value at the path ends with the given suffix (case-insensitive).

func Eq

func Eq[T any](path string, val any) Condition[T]

Eq returns a condition that checks if the value at the path is equal to the given value.

func EqFold

func EqFold[T any](path string, val any) Condition[T]

EqFold returns a condition that checks if the value at the path is equal to the given value (case-insensitive).

func EqualField

func EqualField[T any](path1, path2 string) Condition[T]

EqualField returns a condition that checks if the value at path1 is equal to the value at path2.

func EqualFieldFold

func EqualFieldFold[T any](path1, path2 string) Condition[T]

EqualFieldFold returns a condition that checks if the value at path1 is equal to the value at path2 (case-insensitive).

func Greater

func Greater[T any](path string, val any) Condition[T]

Greater returns a condition that checks if the value at the path is greater than the given value.

func GreaterEqual

func GreaterEqual[T any](path string, val any) Condition[T]

GreaterEqual returns a condition that checks if the value at the path is greater than or equal to the given value.

func GreaterEqualField

func GreaterEqualField[T any](path1, path2 string) Condition[T]

GreaterEqualField returns a condition that checks if the value at path1 is greater than or equal to the value at path2.

func GreaterField

func GreaterField[T any](path1, path2 string) Condition[T]

GreaterField returns a condition that checks if the value at path1 is greater than the value at path2.

func In

func In[T any](path string, values ...any) Condition[T]

In returns a condition that checks if the value at the path is one of the given values.

func InFold

func InFold[T any](path string, values ...any) Condition[T]

InFold returns a condition that checks if the value at the path is one of the given values (case-insensitive).

func Less

func Less[T any](path string, val any) Condition[T]

Less returns a condition that checks if the value at the path is less than the given value.

func LessEqual

func LessEqual[T any](path string, val any) Condition[T]

LessEqual returns a condition that checks if the value at the path is less than or equal to the given value.

func LessEqualField

func LessEqualField[T any](path1, path2 string) Condition[T]

LessEqualField returns a condition that checks if the value at path1 is less than or equal to the value at path2.

func LessField

func LessField[T any](path1, path2 string) Condition[T]

LessField returns a condition that checks if the value at path1 is less than the value at path2.

func Log

func Log[T any](message string) Condition[T]

Log returns a condition that logs the given message during evaluation.

func Matches

func Matches[T any](path, pattern string) Condition[T]

Matches returns a condition that checks if the string value at the path matches the given regex pattern.

func MatchesFold

func MatchesFold[T any](path, pattern string) Condition[T]

MatchesFold returns a condition that checks if the string value at the path matches the given regex pattern (case-insensitive).

func Ne

func Ne[T any](path string, val any) Condition[T]

Ne returns a condition that checks if the value at the path is not equal to the given value.

func NeFold

func NeFold[T any](path string, val any) Condition[T]

NeFold returns a condition that checks if the value at the path is not equal to the given value (case-insensitive).

func Not

func Not[T any](c Condition[T]) Condition[T]

Not returns a condition that represents a logical NOT of a condition.

func NotEqualField

func NotEqualField[T any](path1, path2 string) Condition[T]

NotEqualField returns a condition that checks if the value at path1 is not equal to the value at path2.

func NotEqualFieldFold

func NotEqualFieldFold[T any](path1, path2 string) Condition[T]

NotEqualFieldFold returns a condition that checks if the value at path1 is not equal to the value at path2 (case-insensitive).

func Or

func Or[T any](conds ...Condition[T]) Condition[T]

Or returns a condition that represents a logical OR of multiple conditions.

func ParseCondition

func ParseCondition[T any](expr string) (Condition[T], error)

ParseCondition parses a string expression into a Condition[T] tree.

func StartsWith

func StartsWith[T any](path, val string) Condition[T]

StartsWith returns a condition that checks if the string value at the path starts with the given prefix.

func StartsWithFold

func StartsWithFold[T any](path, val string) Condition[T]

StartsWithFold returns a condition that checks if the string value at the path starts with the given prefix (case-insensitive).

func Type

func Type[T any](path, typeName string) Condition[T]

Type returns a condition that checks if the value at the path has the given type.

func Undefined

func Undefined[T any](path string) Condition[T]

Undefined returns a condition that checks if the value at the path is undefined.

type Conflict

type Conflict struct {
	Path    string
	OpA     OpKind
	ValA    any
	OpB     OpKind
	ValB    any
	Message string
}

Conflict represents a conflict between two patches during a Merge operation.

func (Conflict) String

func (c Conflict) String() string

type ConflictResolver

type ConflictResolver interface {
	// Resolve allows the resolver to intervene before an operation is applied.
	// It returns true if the operation should be applied, false to skip it.
	// The resolver can also modify the operation or target value directly.
	Resolve(path string, op OpKind, key, prevKey any, val reflect.Value) bool
}

ConflictResolver allows custom logic to be injected during patch application. It is used to implement CRDTs, 3-way merges, and other conflict resolution strategies.

type Copier

type Copier[T any] interface {
	// Copy returns a deep copy of the receiver.
	Copy() (T, error)
}

Copier is an interface that types can implement to provide their own custom deep copy logic. The type T in Copy() (T, error) must be the same concrete type as the receiver that implements this interface.

type CopyOption

type CopyOption interface {
	// contains filtered or unexported methods
}

CopyOption allows configuring the behavior of the Copy function.

func CopyIgnorePath

func CopyIgnorePath(path string) CopyOption

CopyIgnorePath returns an option that tells Copy to ignore the specified path. The ignored path will have the zero value for its type in the resulting copy.

func SkipUnsupported

func SkipUnsupported() CopyOption

SkipUnsupported returns an option that tells Copy to skip unsupported types (like non-nil functions or channels) instead of returning an error.

type DefinedCondition

type DefinedCondition[T any] struct {
	Path Path
}

DefinedCondition checks if a path is defined (non-zero).

func (DefinedCondition[T]) Evaluate

func (c DefinedCondition[T]) Evaluate(v *T) (bool, error)

func (DefinedCondition[T]) MarshalJSON

func (c DefinedCondition[T]) MarshalJSON() ([]byte, error)

type DiffOption

type DiffOption interface {
	// contains filtered or unexported methods
}

DiffOption allows configuring the behavior of the Diff function.

func DiffDetectMoves

func DiffDetectMoves(enable bool) DiffOption

DiffDetectMoves returns an option that enables move and copy detection.

func DiffIgnorePath

func DiffIgnorePath(path string) DiffOption

DiffIgnorePath returns an option that tells Diff to ignore changes at the specified path.

type Differ

type Differ struct {
	// contains filtered or unexported fields
}

Differ is a stateless engine for calculating patches between two values.

func NewDiffer

func NewDiffer(opts ...DiffOption) *Differ

NewDiffer creates a new Differ with the given options.

func (*Differ) Diff

func (d *Differ) Diff(a, b any) (diffPatch, error)

Diff compares two values a and b and returns a Patch that can be applied.

type InCondition

type InCondition[T any] struct {
	Path       Path
	Values     []any
	IgnoreCase bool
}

InCondition checks if the value at a path is one of the given values.

func (InCondition[T]) Evaluate

func (c InCondition[T]) Evaluate(v *T) (bool, error)

func (InCondition[T]) MarshalJSON

func (c InCondition[T]) MarshalJSON() ([]byte, error)

type Keyer

type Keyer interface {
	CanonicalKey() any
}

Keyer is an interface that types can implement to provide a canonical representation for map keys. This allows semantic equality checks for complex map keys.

type LogCondition

type LogCondition[T any] struct {
	Message string
}

LogCondition logs a message during evaluation.

func (LogCondition[T]) Evaluate

func (c LogCondition[T]) Evaluate(v *T) (bool, error)

func (LogCondition[T]) MarshalJSON

func (c LogCondition[T]) MarshalJSON() ([]byte, error)

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node represents a specific location within a value's structure.

func (*Node) Add

func (n *Node) Add(i int, val any) error

Add appends an addition operation to a slice node.

func (*Node) AddMapEntry

func (n *Node) AddMapEntry(key, val any) error

AddMapEntry adds a new entry to a map node.

func (*Node) Copy

func (n *Node) Copy(from string) *Node

Copy copies a value from another path to the current node.

func (*Node) Delete

func (n *Node) Delete(keyOrIndex any, oldVal any) error

Delete appends a deletion operation to a slice or map node.

func (*Node) Elem

func (n *Node) Elem() *Node

Elem returns a Node for the element type of a pointer or interface.

func (*Node) Field

func (n *Node) Field(name string) (*Node, error)

Field returns a Node for the specified struct field. It automatically descends into pointers and interfaces if necessary.

func (*Node) FieldOrMapKey

func (n *Node) FieldOrMapKey(key string) (*Node, error)

FieldOrMapKey returns a Node for the specified field or map key.

func (*Node) If

func (n *Node) If(c any) *Node

If attaches an 'if' condition to the current node. If the condition evaluates to false, the operation at this node is skipped.

func (*Node) Index

func (n *Node) Index(i int) (*Node, error)

Index returns a Node for the specified array or slice index.

func (*Node) Log

func (n *Node) Log(message string) *Node

Log adds a log operation to the current node. It prints a message and the current value at the node during patch application.

func (*Node) MapKey

func (n *Node) MapKey(key any) (*Node, error)

MapKey returns a Node for the specified map key.

func (*Node) Move

func (n *Node) Move(from string) *Node

Move moves a value from another path to the current node.

func (*Node) Navigate

func (n *Node) Navigate(path string) (*Node, error)

navigate returns a Node for the specified path relative to the current node. Navigate returns a Node for the specified path relative to the current node. It supports both Go-style paths ("Field.Sub") and JSON Pointers ("/Field/Sub").

func (*Node) NavigateParts

func (n *Node) NavigateParts(parts []pathPart) (*Node, error)

func (*Node) Put

func (n *Node) Put(value any) *Node

Put replaces the value at the current node without requiring the 'old' value. Strict consistency checks for this specific value will be disabled.

func (*Node) Remove

func (n *Node) Remove(oldVal any) error

Remove removes the current node from its parent.

func (*Node) Set

func (n *Node) Set(old, new any) *Node

Set replaces the value at the current node. It requires the 'old' value to enable patch reversibility and strict application checking.

func (*Node) Test

func (n *Node) Test(expected any) *Node

Test adds a test operation to the current node. The patch application will fail if the value at this node does not match the expected value.

func (*Node) Unless

func (n *Node) Unless(c any) *Node

Unless attaches an 'unless' condition to the current node. If the condition evaluates to true, the operation at this node is skipped.

func (*Node) WithCondition

func (n *Node) WithCondition(c any) *Node

WithCondition attaches a local condition to the current node. This condition is evaluated against the value at this node during ApplyChecked.

type NotCondition

type NotCondition[T any] struct {
	C Condition[T]
}

NotCondition represents a logical NOT of a condition.

func (NotCondition[T]) Evaluate

func (c NotCondition[T]) Evaluate(v *T) (bool, error)

func (NotCondition[T]) MarshalJSON

func (c NotCondition[T]) MarshalJSON() ([]byte, error)

type OpKind

type OpKind int

OpKind represents the type of operation in a patch.

const (
	OpAdd OpKind = iota
	OpRemove
	OpReplace
	OpMove
	OpCopy
	OpTest
	OpLog
)

func (OpKind) String

func (k OpKind) String() string

type OrCondition

type OrCondition[T any] struct {
	Conditions []Condition[T]
}

OrCondition represents a logical OR of multiple conditions.

func (OrCondition[T]) Evaluate

func (c OrCondition[T]) Evaluate(v *T) (bool, error)

func (OrCondition[T]) MarshalJSON

func (c OrCondition[T]) MarshalJSON() ([]byte, error)

type Patch

type Patch[T any] interface {
	fmt.Stringer

	// Apply applies the patch to the value pointed to by v.
	// The value v must not be nil.
	Apply(v *T)

	// ApplyChecked applies the patch only if specific conditions are met.
	// 1. If the patch has a global Condition, it must evaluate to true.
	// 2. If Strict mode is enabled, every modification must match the 'oldVal' recorded in the patch.
	// 3. Any local per-field conditions must evaluate to true.
	ApplyChecked(v *T) error

	// ApplyResolved applies the patch using a custom ConflictResolver.
	// This is used for convergent synchronization (CRDTs).
	ApplyResolved(v *T, r ConflictResolver) error

	// Walk calls fn for every operation in the patch.
	// The path is a JSON Pointer dot-notation path (e.g. "/Field/SubField/0").
	// If fn returns an error, walking stops and that error is returned.
	Walk(fn func(path string, op OpKind, old, new any) error) error

	// WithCondition returns a new Patch with the given global condition attached.
	WithCondition(c Condition[T]) Patch[T]

	// WithStrict returns a new Patch with the strict consistency check enabled or disabled.
	WithStrict(strict bool) Patch[T]

	// Reverse returns a new Patch that undoes the changes in this patch.
	Reverse() Patch[T]

	// ToJSONPatch returns an RFC 6902 compliant JSON Patch representation of this patch.
	ToJSONPatch() ([]byte, error)

	// Summary returns a human-readable summary of the changes in the patch.
	Summary() string

	// Release returns the patch and its internal structures to the pool.
	// The patch must not be used after calling this.
	Release()
}

Patch represents a set of changes that can be applied to a value of type T.

func Diff

func Diff[T any](a, b T, opts ...DiffOption) Patch[T]

Diff compares two values a and b and returns a Patch that can be applied.

func DiffTyped

func DiffTyped[T any](d *Differ, a, b T) Patch[T]

DiffTyped is a generic wrapper for Diff that returns a typed Patch[T].

func NewPatch

func NewPatch[T any]() Patch[T]

NewPatch returns a new, empty patch for type T.

type Path

type Path string

Path represents a path to a field or element within a structure. Syntax: "Field", "Field.SubField", "Slice[0]", "Map.Key", "Ptr.Field". It also supports JSON Pointers (RFC 6901) like "/Field/SubField".

func (Path) Navigate

func (p Path) Navigate(v reflect.Value, parts []pathPart) (reflect.Value, pathPart, error)

type StringCondition

type StringCondition[T any] struct {
	Path       Path
	Val        string
	Op         string
	IgnoreCase bool
}

StringCondition checks a string value at a path against a pattern.

func (StringCondition[T]) Evaluate

func (c StringCondition[T]) Evaluate(v *T) (bool, error)

func (StringCondition[T]) MarshalJSON

func (c StringCondition[T]) MarshalJSON() ([]byte, error)

type TypeCondition

type TypeCondition[T any] struct {
	Path     Path
	TypeName string
}

TypeCondition checks if the value at a path has a specific type.

func (TypeCondition[T]) Evaluate

func (c TypeCondition[T]) Evaluate(v *T) (bool, error)

func (TypeCondition[T]) MarshalJSON

func (c TypeCondition[T]) MarshalJSON() ([]byte, error)

type UndefinedCondition

type UndefinedCondition[T any] struct {
	Path Path
}

UndefinedCondition checks if a path is undefined (zero value).

func (UndefinedCondition[T]) Evaluate

func (c UndefinedCondition[T]) Evaluate(v *T) (bool, error)

func (UndefinedCondition[T]) MarshalJSON

func (c UndefinedCondition[T]) MarshalJSON() ([]byte, error)

Directories

Path Synopsis
hlc
examples
audit_logging command
business_rules command
config_manager command
crdt_sync command
custom_types command
http_patch_api command
json_interop command
keyed_inventory command
move_detection command
multi_error command
text_sync command
three_way_merge command
websocket_sync command
internal
resolvers

Jump to

Keyboard shortcuts

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