entities

package
v0.0.0-...-34fd565 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2024 License: AGPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

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 NewFromJSON

func NewFromJSON(body []byte) (types.Entity, error)

func NewFromSlice

func NewFromSlice(body []byte) ([]types.Entity, 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 P

func R

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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