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) Set(key string, value string)
- func (do *DataObject) SetData(data map[string]string) DataObjectFluentInterface
- func (do *DataObject) SetID(id string) DataObjectFluentInterface
- func (do *DataObject) ToJSON() (string, error)
- type DataObjectFluentInterface
- type DataObjectInterface
- type DataObjectRepositoryInterface
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)
Hybernate sets the data for the object without marking as dirty
func (*DataObject) ID ¶
func (do *DataObject) ID() string
func (*DataObject) Init ¶
func (do *DataObject) Init()
func (*DataObject) IsDirty ¶
func (do *DataObject) IsDirty() bool
IsDirty returns if data has been modified
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) DataObjectFluentInterface
SetData sets the data for the object and marks it as dirty see Hydrate for dirtyless assignment
func (*DataObject) SetID ¶
func (do *DataObject) SetID(id string) DataObjectFluentInterface
func (*DataObject) ToJSON ¶ added in v0.1.0
func (do *DataObject) ToJSON() (string, error)
type DataObjectFluentInterface ¶
type DataObjectFluentInterface interface {
// ID returns the ID of the object
ID() string
// SetID sets the ID of the object
SetID(id string) DataObjectFluentInterface
// 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)
}
DataObjectFluentInterface is an interface for a fluent data object
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
type DataObjectRepositoryInterface ¶
type DataObjectRepositoryInterface interface {
Create(dataObject DataObjectInterface) error
Find(id string) (DataObjectInterface, error)
List() ([]DataObjectInterface, error)
Update(dataObject DataObjectInterface) error
}
Click to show internal directories.
Click to hide internal directories.