Documentation ¶
Index ¶
- type DataObject
- func (do *DataObject) Data() map[string]string
- func (do *DataObject) DataChanged() map[string]string
- func (do *DataObject) Get(key string) string
- func (do *DataObject) Hydrate(data map[string]string)
- func (do *DataObject) ID() string
- func (do *DataObject) Init()
- func (do *DataObject) IsDirty() bool
- func (do *DataObject) MarkAsNotDirty()
- func (do *DataObject) Set(key string, value string)
- func (do *DataObject) SetData(data map[string]string)
- func (do *DataObject) SetID(id string)
- func (do *DataObject) ToJSON() (string, error)
- type DataObjectInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataObject ¶
type DataObject struct {
// contains filtered or unexported fields
}
func NewDataObject ¶
func NewDataObject() *DataObject
NewDataObject creates a new data object and generates an ID
func NewDataObjectFromExistingData ¶
func NewDataObjectFromExistingData(data map[string]string) *DataObject
NewDataObjectFromExistingData creates a new data object and hydrates it with the passed data
func NewDataObjectFromJSON ¶ added in v0.1.0
func NewDataObjectFromJSON(jsonString string) (do *DataObject, err error)
func (*DataObject) Data ¶
func (do *DataObject) Data() map[string]string
Data returns all the data of the object
func (*DataObject) DataChanged ¶
func (do *DataObject) DataChanged() map[string]string
DataChanged returns only the modified data
func (*DataObject) Hydrate ¶
func (do *DataObject) Hydrate(data map[string]string)
Hydrate sets the data for the object without marking it as dirty
func (*DataObject) Init ¶
func (do *DataObject) Init()
Init initializes the data object if it is not already initialized
func (*DataObject) IsDirty ¶
func (do *DataObject) IsDirty() bool
IsDirty returns if data has been modified
func (*DataObject) MarkAsNotDirty ¶ added in v0.2.0
func (do *DataObject) MarkAsNotDirty()
MarkAsNotDirty marks the object as not dirty
func (*DataObject) Set ¶
func (do *DataObject) Set(key string, value string)
Set helper setter method
func (*DataObject) SetData ¶
func (do *DataObject) SetData(data map[string]string)
SetData sets the data for the object and marks it as dirty see Hydrate for assignment without marking as dirty
func (*DataObject) ToJSON ¶ added in v0.1.0
func (do *DataObject) ToJSON() (string, error)
ToJSON converts the DataObject to a JSON string
Returns: - the JSON string representation of the DataObject - an error if any
type DataObjectInterface ¶
type DataObjectInterface interface { // ID returns the ID of the object ID() string // SetID sets the ID of the object SetID(id string) // GetData returns the data for the object Data() map[string]string // GetChangedData returns the data that has been changed since the last hydration DataChanged() map[string]string // Hydrates the data object with data Hydrate(map[string]string) }
DataObjectInterface is an interface for a data object