Documentation
¶
Index ¶
- Constants
- Variables
- func SetNodeMeasureValue(node graph.Node, value Measure) error
- func ToGomentTime(time time.Time) (*goment.Goment, error)
- type Date
- type DateTime
- type ErrCannotParseTemporalValue
- type ErrIncompatibleTypes
- type ErrMultipleNodesMatch
- type ErrNotAMeasure
- type GDay
- type GMonth
- type GMonthDay
- type GYear
- type GYearMonth
- type JSONBooleanParser
- type JSONDateParser
- type JSONDateTimeParser
- type JSONTimeParser
- type Measure
- type PatternDateParser
- type PatternDateTimeParser
- type PatternTimeParser
- type TimeOfDay
- type UnixTime
- type UnixTimeNano
- type UnixTimeNanoParser
- type UnixTimeParser
- type XMLBooleanParser
- type XSDDateParser
- type XSDDateTimeParser
- type XSDGDayParser
- type XSDGMonthDayParser
- type XSDGMonthParser
- type XSDGYearMonthParser
- type XSDGYearParser
- type XSDTimeParser
Constants ¶
const JSON = "https:/json-schema.org/"
const Unix = "https://unixtime.org/"
const XSD = "http://www.w3.org/2001/XMLSchema/"
Variables ¶
var GoTimeFormatTerm = ls.NewTerm(ls.LS, "goTimeFormat", false, false, ls.SetComposition, nil, "ls:goTimeFormat")
var JSONBooleanTerm = ls.NewTerm(JSON, "boolean", false, false, ls.OverrideComposition, struct { JSONBooleanParser }{ JSONBooleanParser{}, }, "json:boolean")
var JSONDateTerm = ls.NewTerm(JSON, "date", false, false, ls.OverrideComposition, struct { JSONDateParser }{ JSONDateParser: JSONDateParser{}, }, "json:date")
JSONDate is a node-type that identifies the underlying value as a JSON date value
YYYY-MM-DD
var JSONDateTimeTerm = ls.NewTerm(JSON, "date-time", false, false, ls.OverrideComposition, struct { JSONDateTimeParser }{ JSONDateTimeParser: JSONDateTimeParser{}, }, "json:date-time")
JSONDateTime is a node-type that identifies the underlying value as a JSON datetime value, RFC3339 or RFC3339Nano
YYYY-MM-DDTHH:mm:ssZ YYYY-MM-DDTHH:mm:ss.00000Z
var JSONTimeTerm = ls.NewTerm(JSON, "time", false, false, ls.OverrideComposition, struct { JSONTimeParser }{ JSONTimeParser: JSONTimeParser{}, }, "json:time")
JSONTime is a node-type that identifies the underlying value as a JSON time value
HH:mm HH:mm:ss HH:mm:ssZ
var MeasureTerm = ls.NewTerm(ls.LS, "Measure", false, false, ls.OverrideComposition, struct {
measureParser
}{
measureParser{},
})
MeasureTerm is used as a valueType.
A measure should have a value and a unit. There are several ways the values and units are specified.
A node may specify value and unit in its node value.
Node:
Measure value: value and unit
A node may specify value and unit separately in its properties:
Node:
Measure value: 123 measureUnit: <unit>
A node may be point to other nodes containing value or unit.
Node: Node: Measure value: <unit> value: 123 schemaNodeId: A measureUnitNode: A Node: Node: Node: Measure value: <unit> value: <value> measureUnitNode: A schemaNodeId: A schemaNodeId: B measureValueNode: B
A node may refer to other nodes using pattern expressions
Node: Measure value: 123 measureUnitPath: (this)<-[]-()-[]->(target : schemaNodeId:B) Node: value: <unit> schemaNodeId: B
var MeasureUnitNodeTerm = ls.NewTerm(ls.LS, "measure/unitNode", false, false, ls.OverrideComposition, nil)
MeasureUnitNodeTerm gives the schema node ID of the unit node
var MeasureUnitPathTerm = ls.NewTerm(ls.LS, "measure/unitPath", false, false, ls.OverrideComposition, nil)
MeasureUnitPathTerm gives the path to the unit node
var MeasureUnitTerm = ls.NewTerm(ls.LS, "measure/unit", false, false, ls.OverrideComposition, nil)
MeasureUnitTerm is a node property term giving measure unit
var MeasureValueNodeTerm = ls.NewTerm(ls.LS, "measure/valueNode", false, false, ls.OverrideComposition, nil)
MeasureValueNodeTerm gives the schema node ID of the value node
var MeasureValuePathTerm = ls.NewTerm(ls.LS, "measure/valuePath", false, false, ls.OverrideComposition, nil)
MeasureValuePathTerm gives the path to the value node
var MomentTimeFormatTerm = ls.NewTerm(ls.LS, "momentTimeFormat", false, false, ls.SetComposition, nil, "ls:momentTimeFormat")
var PatternDateTerm = ls.NewTerm(ls.LS, "date", false, false, ls.OverrideComposition, struct { PatternDateParser }{ PatternDateParser: PatternDateParser{}, }, "ls:date")
var PatternDateTimeTerm = ls.NewTerm(ls.LS, "dateTime", false, false, ls.OverrideComposition, struct { PatternDateTimeParser }{ PatternDateTimeParser: PatternDateTimeParser{}, }, "ls:dateTime")
var PatternTimeTerm = ls.NewTerm(ls.LS, "time", false, false, ls.OverrideComposition, struct { PatternTimeParser }{ PatternTimeParser: PatternTimeParser{}, }, "ls:time")
var UnixTimeNanoTerm = ls.NewTerm(Unix, "timeNano", false, false, ls.OverrideComposition, struct { UnixTimeNanoParser }{ UnixTimeNanoParser: UnixTimeNanoParser{}, }, "unix:timeNano")
var UnixTimeTerm = ls.NewTerm(Unix, "time", false, false, ls.OverrideComposition, struct { UnixTimeParser }{ UnixTimeParser: UnixTimeParser{}, }, "unix:time")
var XMLBooleanTerm = ls.NewTerm(XSD, "boolean", false, false, ls.OverrideComposition, struct { XMLBooleanParser }{ XMLBooleanParser{}, }, "xsd:boolean", "xs:boolean")
var XSDDateTerm = ls.NewTerm(XSD, "date", false, false, ls.OverrideComposition, struct { XSDDateParser }{ XSDDateParser: XSDDateParser{}, }, "xsd:date", "xs:date")
XSDDate is a node-type that identifies the underlying value as an XML date. The format is:
[-]CCYY-MM-DD[Z|(+|-)hh:mm]
var XSDDateTimeTerm = ls.NewTerm(XSD, "dateTime", false, false, ls.OverrideComposition, struct { XSDDateTimeParser }{ XSDDateTimeParser: XSDDateTimeParser{}, }, "xsd:dateTime", "xs:dateTime")
XSDDateTime is a node-type that identifies the underlying value as an XML date-time value
var XSDGDayTerm = ls.NewTerm(XSD, "gDay", false, false, ls.OverrideComposition, struct { XSDGDayParser }{ XSDGDayParser: XSDGDayParser{}, }, "xsd:gDay", "xs:gDay")
XSDGday can be used as a node-type to interpret the underlying value as a day (GDay)
var XSDGMonthDayTerm = ls.NewTerm(XSD, "gMonthDay", false, false, ls.OverrideComposition, struct { XSDGMonthDayParser }{ XSDGMonthDayParser: XSDGMonthDayParser{}, }, "xsd:gMonthDay", "xs:gMonthDay")
XSDMonthDay can be used as a node-type to interpret the underlying value as a MM-DD
var XSDGMonthTerm = ls.NewTerm(XSD, "gMonth", false, false, ls.OverrideComposition, struct { XSDGMonthParser }{ XSDGMonthParser: XSDGMonthParser{}, }, "xsd:gMonth", "xs:gMonth")
XSDGMonth can be used as node-type to interpret the underlying value as a month (int)
var XSDGYearMonthTerm = ls.NewTerm(XSD, "gYearMonth", false, false, ls.OverrideComposition, struct { XSDGYearMonthParser }{ XSDGYearMonthParser: XSDGYearMonthParser{}, }, "xsd:gYearMonth", "xs:gYearMonth")
XSDGYearMonth can be used as a node-type to interpret the underlying value as a YYYY-MM
var XSDGYearTerm = ls.NewTerm(XSD, "gYear", false, false, ls.OverrideComposition, struct { XSDGYearParser }{ XSDGYearParser: XSDGYearParser{}, }, "xsd:gYear", "xs:gYear")
XSDGYear can be used as a node-type to interpret the underlying value as a year value (int)
var XSDTimeTerm = ls.NewTerm(XSD, "time", false, false, ls.OverrideComposition, struct { XSDTimeParser }{ XSDTimeParser: XSDTimeParser{}, }, "xsd:time", "xs:time")
XSDTime is a node-type that identifies the underlying value as an XML time.
Functions ¶
func SetNodeMeasureValue ¶
SetNodeMeasureValue tries to set the measure and unit values based on the given Measure value
Types ¶
type DateTime ¶
type ErrCannotParseTemporalValue ¶
type ErrCannotParseTemporalValue string
func (ErrCannotParseTemporalValue) Error ¶
func (e ErrCannotParseTemporalValue) Error() string
type ErrIncompatibleTypes ¶
type ErrIncompatibleTypes struct {
// contains filtered or unexported fields
}
func (ErrIncompatibleTypes) Error ¶
func (e ErrIncompatibleTypes) Error() string
type ErrMultipleNodesMatch ¶
type ErrMultipleNodesMatch struct {
Src string
}
func (ErrMultipleNodesMatch) Error ¶
func (e ErrMultipleNodesMatch) Error() string
type ErrNotAMeasure ¶
type ErrNotAMeasure struct {
Value string
}
func (ErrNotAMeasure) Error ¶
func (e ErrNotAMeasure) Error() string
type GYearMonth ¶
GYearMonth is XML Gregorian part of Year/Month
func (GYearMonth) String ¶
func (g GYearMonth) String() string
type JSONBooleanParser ¶
type JSONBooleanParser struct{}
func (JSONBooleanParser) GetNodeValue ¶
func (JSONBooleanParser) GetNodeValue(node graph.Node) (interface{}, error)
func (JSONBooleanParser) SetNodeValue ¶
func (JSONBooleanParser) SetNodeValue(node graph.Node, value interface{}) error
type JSONDateParser ¶
type JSONDateParser struct{}
func (JSONDateParser) GetNodeValue ¶
func (JSONDateParser) GetNodeValue(node graph.Node) (interface{}, error)
ParseValue parses a JSON date
YYYY-MM-DD
func (JSONDateParser) SetNodeValue ¶
func (JSONDateParser) SetNodeValue(node graph.Node, value interface{}) error
SetValue gets a target node and it's go native value, and sets the value of the target node to an JSONDate
type JSONDateTimeParser ¶
type JSONDateTimeParser struct{}
func (JSONDateTimeParser) GetNodeValue ¶
func (JSONDateTimeParser) GetNodeValue(node graph.Node) (interface{}, error)
ParseValue parses a JSON date-time
YYYY-MM-DD
func (JSONDateTimeParser) SetNodeValue ¶
func (JSONDateTimeParser) SetNodeValue(node graph.Node, value interface{}) error
"2006-01-02T11:11:11Z07:00" -> Note: uses a 24Hour based clock "2006-01-02T11:11:11.999999999Z07:00"
type JSONTimeParser ¶
type JSONTimeParser struct{}
func (JSONTimeParser) GetNodeValue ¶
func (JSONTimeParser) GetNodeValue(node graph.Node) (interface{}, error)
ParseValue parses a JSON time
HH:mm HH:mm:ss HH:mm:ssZ
func (JSONTimeParser) SetNodeValue ¶
func (JSONTimeParser) SetNodeValue(node graph.Node, value interface{}) error
type Measure ¶
type Measure struct { Value string `json:"value" yaml:"value"` Unit string `json:"unit" yaml:"unit"` }
Measure is the data type that contains a value and a unit
type PatternDateParser ¶
type PatternDateParser struct{}
func (PatternDateParser) GetNodeValue ¶
func (PatternDateParser) GetNodeValue(node graph.Node) (interface{}, error)
ParseValue looks at the goTimeFormat, momentTimeFormat properties in the node, and parses the datetime using that. The format property can be an array, giving all possible formats
func (PatternDateParser) SetNodeValue ¶
func (PatternDateParser) SetNodeValue(node graph.Node, value interface{}) error
type PatternDateTimeParser ¶
type PatternDateTimeParser struct{}
func (PatternDateTimeParser) GetNodeValue ¶
func (PatternDateTimeParser) GetNodeValue(node graph.Node) (interface{}, error)
ParseValue looks at the goTimeFormat, momentTimeFormat properties in the node, and parses the datetime using that. The format property can be an array, giving all possible formats
func (PatternDateTimeParser) SetNodeValue ¶
func (PatternDateTimeParser) SetNodeValue(node graph.Node, value interface{}) error
type PatternTimeParser ¶
type PatternTimeParser struct{}
func (PatternTimeParser) GetNodeValue ¶
func (PatternTimeParser) GetNodeValue(node graph.Node) (interface{}, error)
ParseValue looks at the goTimeFormat, momentTimeFormat properties in the node, and parses the datetime using that. The format property can be an array, giving all possible formats
func (PatternTimeParser) SetNodeValue ¶
func (PatternTimeParser) SetNodeValue(node graph.Node, value interface{}) error
type TimeOfDay ¶
type UnixTimeNano ¶
func (UnixTimeNano) String ¶
func (u UnixTimeNano) String() string
func (UnixTimeNano) ToTime ¶
func (u UnixTimeNano) ToTime() time.Time
type UnixTimeNanoParser ¶
type UnixTimeNanoParser struct{}
func (UnixTimeNanoParser) GetNodeValue ¶
func (UnixTimeNanoParser) GetNodeValue(node graph.Node) (interface{}, error)
func (UnixTimeNanoParser) SetNodeValue ¶
func (UnixTimeNanoParser) SetNodeValue(node graph.Node, value interface{}) error
type UnixTimeParser ¶
type UnixTimeParser struct{}
func (UnixTimeParser) GetNodeValue ¶
func (UnixTimeParser) GetNodeValue(node graph.Node) (interface{}, error)
func (UnixTimeParser) SetNodeValue ¶
func (UnixTimeParser) SetNodeValue(node graph.Node, value interface{}) error
type XMLBooleanParser ¶
type XMLBooleanParser struct{}
func (XMLBooleanParser) GetNodeValue ¶
func (XMLBooleanParser) GetNodeValue(node graph.Node) (interface{}, error)
func (XMLBooleanParser) SetNodeValue ¶
func (XMLBooleanParser) SetNodeValue(node graph.Node, value interface{}) error
type XSDDateParser ¶
type XSDDateParser struct{}
func (XSDDateParser) GetNodeValue ¶
func (XSDDateParser) GetNodeValue(node graph.Node) (interface{}, error)
ParseValue parses an XSDDate value.
[-]CCYY-MM-DD[Z|(+|-)hh:mm]
func (XSDDateParser) SetNodeValue ¶
func (XSDDateParser) SetNodeValue(node graph.Node, value interface{}) error
SetValue gets a target node and it's go native value, and sets the value of the target node to an XSDDate
type XSDDateTimeParser ¶
type XSDDateTimeParser struct{}
func (XSDDateTimeParser) GetNodeValue ¶
func (XSDDateTimeParser) GetNodeValue(node graph.Node) (interface{}, error)
func (XSDDateTimeParser) SetNodeValue ¶
func (XSDDateTimeParser) SetNodeValue(node graph.Node, value interface{}) error
type XSDGDayParser ¶
type XSDGDayParser struct{}
func (XSDGDayParser) GetNodeValue ¶
func (XSDGDayParser) GetNodeValue(node graph.Node) (interface{}, error)
func (XSDGDayParser) SetNodeValue ¶
func (XSDGDayParser) SetNodeValue(node graph.Node, value interface{}) error
type XSDGMonthDayParser ¶
type XSDGMonthDayParser struct{}
func (XSDGMonthDayParser) GetNodeValue ¶
func (XSDGMonthDayParser) GetNodeValue(node graph.Node) (interface{}, error)
func (XSDGMonthDayParser) SetNodeValue ¶
func (XSDGMonthDayParser) SetNodeValue(node graph.Node, value interface{}) error
type XSDGMonthParser ¶
type XSDGMonthParser struct{}
func (XSDGMonthParser) GetNodeValue ¶
func (XSDGMonthParser) GetNodeValue(node graph.Node) (interface{}, error)
func (XSDGMonthParser) SetNodeValue ¶
func (XSDGMonthParser) SetNodeValue(node graph.Node, value interface{}) error
type XSDGYearMonthParser ¶
type XSDGYearMonthParser struct{}
func (XSDGYearMonthParser) GetNodeValue ¶
func (XSDGYearMonthParser) GetNodeValue(node graph.Node) (interface{}, error)
func (XSDGYearMonthParser) SetNodeValue ¶
func (XSDGYearMonthParser) SetNodeValue(node graph.Node, value interface{}) error
type XSDGYearParser ¶
type XSDGYearParser struct{}
func (XSDGYearParser) GetNodeValue ¶
func (XSDGYearParser) GetNodeValue(node graph.Node) (interface{}, error)
func (XSDGYearParser) SetNodeValue ¶
func (XSDGYearParser) SetNodeValue(node graph.Node, value interface{}) error
type XSDTimeParser ¶
type XSDTimeParser struct{}
func (XSDTimeParser) GetNodeValue ¶
func (XSDTimeParser) GetNodeValue(node graph.Node) (interface{}, error)
func (XSDTimeParser) SetNodeValue ¶
func (XSDTimeParser) SetNodeValue(node graph.Node, value interface{}) error