properties

package
v0.0.0-...-11504e0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DateCreated  string = "dateCreated"
	DateModified string = "dateModified"
	DateObserved string = "dateObserved"

	Description string = "description"
	Location    string = "location"
	Name        string = "name"
)

Variables

This section is empty.

Functions

func UnmarshalP

func UnmarshalP(body map[string]any) (types.Property, error)

Types

type DateTimeProperty

type DateTimeProperty struct {
	PropertyImpl
	Val struct {
		Type  string `json:"@type"`
		Value string `json:"@value"`
	} `json:"value"`
}

DateTimeProperty stores date and time values (surprise, surprise ...)

func NewDateTimeProperty

func NewDateTimeProperty(value string) *DateTimeProperty

NewDateTimeProperty creates a property from a UTC time stamp

func (*DateTimeProperty) Type

func (dtp *DateTimeProperty) Type() string

func (*DateTimeProperty) Value

func (dtp *DateTimeProperty) Value() any

type NumberProperty

type NumberProperty struct {
	PropertyImpl
	Val         float64            `json:"value"`
	ObservedAt_ *string            `json:"observedAt,omitempty"`
	ObservedBy  types.Relationship `json:"observedBy,omitempty"`
	UnitCode    *string            `json:"unitCode,omitempty"`
}

NumberProperty holds a float64 Value

func NewNumberProperty

func NewNumberProperty(value float64) *NumberProperty

NewNumberProperty is a convenience function for creating NumberProperty instances

func NewNumberPropertyFromString

func NewNumberPropertyFromString(value string) *NumberProperty

NewNumberPropertyFromString accepts a value as a string and returns a new NumberProperty

func (*NumberProperty) ObservedAt

func (np *NumberProperty) ObservedAt() string

func (*NumberProperty) Type

func (np *NumberProperty) Type() string

func (*NumberProperty) Value

func (np *NumberProperty) Value() any

type NumberPropertyDecoratorFunc

type NumberPropertyDecoratorFunc func(np *NumberProperty)

func ObservedAt

func ObservedAt(timestamp string) NumberPropertyDecoratorFunc

func ObservedBy

func ObservedBy(object string) NumberPropertyDecoratorFunc

func UnitCode

func UnitCode(code string) NumberPropertyDecoratorFunc

type PropertyImpl

type PropertyImpl struct {
	Type string `json:"type"`
}

Property contains the mandatory Type property

type TextListProperty

type TextListProperty struct {
	PropertyImpl
	Val         []string `json:"value"`
	ObservedAt_ *string  `json:"observedAt,omitempty"`
}

TextListProperty stores values of type text list

func NewTextListProperty

func NewTextListProperty(value []string) *TextListProperty

NewTextListProperty accepts a value as a string array and returns a new TextListProperty

func (*TextListProperty) ObservedAt

func (tlp *TextListProperty) ObservedAt() string

func (*TextListProperty) Type

func (tlp *TextListProperty) Type() string

func (*TextListProperty) Value

func (tlp *TextListProperty) Value() any

type TextProperty

type TextProperty struct {
	PropertyImpl
	Val         string  `json:"value"`
	ObservedAt_ *string `json:"observedAt,omitempty"`
}

TextProperty stores values of type text

func NewTextProperty

func NewTextProperty(value string) *TextProperty

NewTextProperty accepts a value as a string and returns a new TextProperty

func (*TextProperty) ObservedAt

func (tp *TextProperty) ObservedAt() string

func (*TextProperty) Type

func (tp *TextProperty) Type() string

func (*TextProperty) Value

func (tp *TextProperty) Value() any

type TextPropertyDecoratorFunc

type TextPropertyDecoratorFunc func(np *TextProperty)

func TxtObservedAt

func TxtObservedAt(timestamp string) TextPropertyDecoratorFunc

Jump to

Keyboard shortcuts

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