Documentation
¶
Index ¶
- type Slice
- func (s Slice[T]) GetValue() any
- func (s Slice[T]) IsChanged() bool
- func (s Slice[T]) Length() int
- func (s Slice[T]) MarshalJSON() ([]byte, error)
- func (s *Slice[T]) Reset()
- func (s *Slice[T]) SetValue(value any) error
- func (s Slice[T]) Unchanged() []T
- func (s *Slice[T]) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Slice ¶
type Slice[T comparable] struct { Values []T `json:"values" bson:"values"` Added []T `json:"-" bson:"-"` Deleted []T `json:"-" bson:"-"` }
Slice tracks changes to a slice of generic values. As items are added or removed from the slice, they are tracked in the "Added" and "Deleted" lists.
func NewSlice ¶
func NewSlice[T comparable](values ...T) Slice[T]
NewSlice returns a fully initialized Slice object
func (Slice[T]) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface and serializes the Slice into a JSON array
func (*Slice[T]) SetValue ¶
SetValue implements schema.ValueSetter and updates the current value, tracking changes to the added and deleted lists.
func (Slice[T]) Unchanged ¶ added in v0.25.4
func (s Slice[T]) Unchanged() []T
Unchanged returns the values that have not been added or removed
func (*Slice[T]) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface and deserializes the Slice from a JSON array
Click to show internal directories.
Click to hide internal directories.