object

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2025 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PropertyObject

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

PropertyObject is a basic implementation of PropertyObjectInterface

func (*PropertyObject) Clear

func (p *PropertyObject) Clear()

Clear removes all properties

func (*PropertyObject) Count

func (p *PropertyObject) Count() int

Count returns the number of properties

func (*PropertyObject) Get

func (p *PropertyObject) Get(key string) any

Get retrieves a property value by key

func (*PropertyObject) Has

func (p *PropertyObject) Has(key string) bool

Has checks if a property exists

func (*PropertyObject) Keys

func (p *PropertyObject) Keys() []string

Keys returns all property keys

func (*PropertyObject) Set

func (p *PropertyObject) Set(key string, value any) error

Set stores a property value with the given key

func (*PropertyObject) Unset

func (p *PropertyObject) Unset(key string)

Unset removes a property by key

type PropertyObjectInterface

type PropertyObjectInterface interface {
	Clear()
	Count() int
	Get(key string) any
	Has(key string) bool
	Keys() []string
	Set(key string, value any) error
	Unset(key string)
}

PropertyObjectInterface defines the interface for objects that can store and retrieve properties

func NewPropertyObject

func NewPropertyObject() PropertyObjectInterface

NewPropertyObject creates a new PropertyObject

type SerializableInterface

type SerializableInterface interface {
	// GetID returns the unique identifier for this object
	GetID() string

	// SetID sets the unique identifier for this object
	SetID(id string)

	// ToJSON serializes the object to JSON
	ToJSON() ([]byte, error)

	// FromJSON deserializes JSON data into the object
	FromJSON(data []byte) error
}

SerializableInterface defines an interface for objects that can be serialized/deserialized

type SerializablePropertyObject

type SerializablePropertyObject struct {
	PropertyObject
}

SerializablePropertyObject extends PropertyObject with ID and serialization capabilities

func (*SerializablePropertyObject) FromJSON

func (s *SerializablePropertyObject) FromJSON(data []byte) error

FromJSON deserializes JSON data into the SerializablePropertyObject

func (*SerializablePropertyObject) GetID

GetID returns the unique identifier for this object

func (*SerializablePropertyObject) SetID

func (s *SerializablePropertyObject) SetID(id string)

SetID sets the unique identifier for this object

func (*SerializablePropertyObject) ToJSON

func (s *SerializablePropertyObject) ToJSON() ([]byte, error)

ToJSON serializes the SerializablePropertyObject to JSON

type SerializablePropertyObjectInterface

type SerializablePropertyObjectInterface interface {
	PropertyObjectInterface
	SerializableInterface
}

SerializablePropertyObjectInterface combines PropertyObjectInterface and SerializableInterface

func NewSerializablePropertyObject

func NewSerializablePropertyObject() SerializablePropertyObjectInterface

NewSerializablePropertyObject creates a new SerializablePropertyObject with a generated UUID

Jump to

Keyboard shortcuts

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