change

package
v0.3.12 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

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

func NewEntry

func NewEntry(changeType Type, itemType int, item any) *Entry

func (*Entry) GetChangeType

func (e *Entry) GetChangeType() Type

func (*Entry) GetItem

func (e *Entry) GetItem() any

func (*Entry) GetItemType

func (e *Entry) GetItemType() int

type List

type List[T comparable] struct {
	// contains filtered or unexported fields
}

List is a generic type used to track changes in a model. T must conform to the comparable constraint to ensure consistent behaviour with map keys.

func NewChanges

func NewChanges[T comparable]() List[T]

func (*List[T]) ClearChanges

func (b *List[T]) ClearChanges()

ClearChanges removes all tracked changes by resetting the internal map to an empty state. This method is only supposed to be called by the repository implementations.

func (*List[T]) GetChanges

func (b *List[T]) GetChanges() []T

GetChanges returns a slice of all tracked changes in the Changes collection.

func (*List[T]) HasChanges

func (b *List[T]) HasChanges() bool

HasChanges checks if any changes have been tracked in the Changes collection. Returns true if there are tracked changes, false otherwise.

func (*List[T]) TrackChange

func (b *List[T]) TrackChange(key T)

TrackChange adds the given key to the changes map to indicate a modification of the corresponding property.

type Tracker

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

func NewTracker

func NewTracker() *Tracker

func (*Tracker) Add

func (t *Tracker) Add(entry *Entry)

func (*Tracker) Clear

func (t *Tracker) Clear()

func (*Tracker) GetChanges

func (t *Tracker) GetChanges() []*Entry

type Type

type Type int
const (
	Added Type = iota
	Updated
	Deleted
)

Jump to

Keyboard shortcuts

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