Documentation ¶
Index ¶
- Constants
- func New(entityID, entityType string, decorators ...EntityDecoratorFunc) (types.Entity, error)
- func NewFragment(decorators ...EntityDecoratorFunc) (types.EntityFragment, error)
- func NewFragmentFromJSON(body []byte) (types.EntityFragment, error)
- func NewFromJSON(body []byte) (types.Entity, error)
- func NewFromSlice(body []byte) ([]types.Entity, error)
- func NewTemporalFromJSON(body []byte) (types.EntityTemporal, error)
- func ValidateFragmentAttributes(fragment types.EntityFragment, expectations map[string]any) (err error)
- type EntityDecoratorFunc
- type EntityImpl
- func (e EntityImpl) ForEachAttribute(callback func(attributeType, attributeName string, contents any)) error
- func (e EntityImpl) ID() string
- func (e EntityImpl) KeyValues() types.EntityKeyValueMapper
- func (e EntityImpl) MarshalJSON() ([]byte, error)
- func (e *EntityImpl) RemoveAttribute(predicate func(attributeType, attributeName string, contents any) bool)
- func (e EntityImpl) Type() string
- func (e *EntityImpl) UnmarshalJSON(data []byte) error
- type EntityTemporalImpl
Constants ¶
View Source
const DefaultContextURL string = "https://raw.githubusercontent.com/diwise/context-broker/main/assets/jsonldcontexts/default-context.jsonld"
View Source
const DefaultNGSITenant string = ""
View Source
const LinkHeader string = `<` + DefaultContextURL + `>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"`
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(entityID, entityType string, decorators ...EntityDecoratorFunc) (types.Entity, error)
func NewFragment ¶
func NewFragment(decorators ...EntityDecoratorFunc) (types.EntityFragment, error)
func NewFragmentFromJSON ¶
func NewFragmentFromJSON(body []byte) (types.EntityFragment, error)
func NewTemporalFromJSON ¶
func NewTemporalFromJSON(body []byte) (types.EntityTemporal, error)
func ValidateFragmentAttributes ¶
func ValidateFragmentAttributes(fragment types.EntityFragment, expectations map[string]any) (err error)
Types ¶
type EntityDecoratorFunc ¶
type EntityDecoratorFunc func(e *EntityImpl)
func Context ¶
func Context(ctx []string) EntityDecoratorFunc
func DefaultBrokerContext ¶
func DefaultBrokerContext(brokerURL string) EntityDecoratorFunc
func DefaultContext ¶
func DefaultContext() EntityDecoratorFunc
func R ¶
func R(name string, value types.Relationship) EntityDecoratorFunc
type EntityImpl ¶
type EntityImpl struct {
// contains filtered or unexported fields
}
func (EntityImpl) ForEachAttribute ¶
func (e EntityImpl) ForEachAttribute(callback func(attributeType, attributeName string, contents any)) error
func (EntityImpl) ID ¶
func (e EntityImpl) ID() string
func (EntityImpl) KeyValues ¶
func (e EntityImpl) KeyValues() types.EntityKeyValueMapper
func (EntityImpl) MarshalJSON ¶
func (e EntityImpl) MarshalJSON() ([]byte, error)
func (*EntityImpl) RemoveAttribute ¶
func (e *EntityImpl) RemoveAttribute(predicate func(attributeType, attributeName string, contents any) bool)
func (EntityImpl) Type ¶
func (e EntityImpl) Type() string
func (*EntityImpl) UnmarshalJSON ¶
func (e *EntityImpl) UnmarshalJSON(data []byte) error
type EntityTemporalImpl ¶
type EntityTemporalImpl struct {
// contains filtered or unexported fields
}
func (EntityTemporalImpl) ID ¶
func (e EntityTemporalImpl) ID() string
func (EntityTemporalImpl) MarshalJSON ¶
func (e EntityTemporalImpl) MarshalJSON() ([]byte, error)
func (EntityTemporalImpl) Property ¶
func (e EntityTemporalImpl) Property(name string) []types.TemporalProperty
func (EntityTemporalImpl) Type ¶
func (e EntityTemporalImpl) Type() string
func (*EntityTemporalImpl) UnmarshalJSON ¶
func (e *EntityTemporalImpl) UnmarshalJSON(data []byte) error
Click to show internal directories.
Click to hide internal directories.