Documentation ¶
Index ¶
- Variables
- func AnyURIValueTypeName() string
- func HasAnyURI(r []RangeReference) bool
- func IsActivity(t *Type) bool
- func IsAnyURIValueType(v *ValueType) bool
- func IsIRIValueType(v *ValueType) bool
- func IsIRIValueTypeString(v *ValueType) bool
- func IsOnlyOtherPropertyBesidesIRI(nonIriIndex int, r []RangeReference) bool
- type DomainReference
- type FunctionDef
- type FunctionVarDef
- type InterfaceDef
- type MemberFunctionDef
- type PackageDef
- type PropertyType
- type RangeReference
- type StructDef
- type StructMember
- type Type
- type ValueType
Constants ¶
This section is empty.
Variables ¶
View Source
var (
AllCoreTypes = []*Type{
objectType,
linkType,
activityType,
intransitiveActivityType,
collectionType,
orderedCollectionType,
collectionPageType,
orderedCollectionPageType,
}
)
View Source
var (
AllExtendedTypes = []*Type{
acceptExtendedType,
tentativeAcceptExtendedType,
addExtendedType,
arriveExtendedType,
createExtendedType,
deleteExtendedType,
followExtendedType,
ignoreExtendedType,
joinExtendedType,
leaveExtendedType,
likeExtendedType,
offerExtendedType,
inviteExtendedType,
rejectExtendedType,
tentativeRejectExtendedType,
removeExtendedType,
undoExtendedType,
updateExtendedType,
viewExtendedType,
listenExtendedType,
readExtendedType,
moveExtendedType,
travelExtendedType,
announceExtendedType,
blockExtendedType,
flagExtendedType,
dislikeExtendedType,
questionExtendedType,
applicationExtendedType,
groupExtendedType,
organizationExtendedType,
personExtendedType,
serviceExtendedType,
relationshipExtendedType,
articleExtendedType,
documentExtendedType,
audioExtendedType,
imageExtendedType,
videoExtendedType,
noteExtendedType,
pageExtendedType,
eventExtendedType,
placeExtendedType,
profileExtendedType,
tombstoneExtendedType,
mentionExtendedType,
}
)
View Source
var (
AllPropertyTypes = []*PropertyType{
idPropertyType,
typePropertyType,
actorPropertyType,
attachmentPropertyType,
attributedToPropertyType,
audiencePropertyType,
bccPropertyType,
btoPropertyType,
ccPropertyType,
contextPropertyType,
currentPropertyType,
currentOrderedPropertyType,
firstPropertyType,
firstOrderedPropertyType,
generatorPropertyType,
iconPropertyType,
imagePropertyType,
inReplyToPropertyType,
instrumentPropertyType,
lastPropertyType,
lastOrderedPropertyType,
locationPropertyType,
itemsPropertyType,
orderedItemsPropertyType,
oneOfPropertyType,
anyOfPropertyType,
closedPropertyType,
originPropertyType,
nextPropertyType,
nextOrderedPropertyType,
objectPropertyType,
prevPropertyType,
prevOrderedPropertyType,
previewPropertyType,
resultPropertyType,
repliesPropertyType,
tagPropertyType,
targetPropertyType,
toPropertyType,
urlPropertyType,
accuracyPropertyType,
altitudePropertyType,
contentPropertyType,
namePropertyType,
durationPropertyType,
heightPropertyType,
hrefPropertyType,
hrefLangPropertyType,
partOfPropertyType,
latitudePropertyType,
longitudePropertyType,
mediaTypePropertyType,
endTimePropertyType,
publishedPropertyType,
startTimePropertyType,
radiusPropertyType,
relPropertyType,
startIndexPropertyType,
summaryPropertyType,
totalItemsPropertyType,
unitsPropertyType,
updatedPropertyType,
widthPropertyType,
subjectPropertyType,
relationshipPropertyType,
describesPropertyType,
formerTypePropertyType,
deletedPropertyType,
sourcePropertyType,
inboxPropertyType,
outboxPropertyType,
followingPropertyType,
followersPropertyType,
likedPropertyType,
likesPropertyType,
streamsPropertyType,
preferredUsernamePropertyType,
endpointsPropertyType,
proxyUrlPropertyType,
oauthAuthorizationEndpointPropertyType,
oauthTokenEndpointPropertyType,
provideClientKeyPropertyType,
signClientKeyPropertyType,
sharedInboxPropertyType,
}
)
View Source
var (
AllValueTypes = []*ValueType{
xsdDateTimeValueType,
xsdBooleanValueType,
xsdAnyURIValueType,
xsdFloatValueType,
xsdStringValueType,
rdfLangStringValueType,
xsdDurationValueType,
xsdNonNegativeIntegerValueType,
bcp47LangTag,
mimeMediaValueType,
linkRelationValueType,
unitsValueType,
}
)
View Source
var IriValueType = &ValueType{ Name: "IRI", URI: "IRI", DefinitionType: "*url.URL", Zero: "nil", DeserializeFn: &FunctionDef{ Name: "IRIDeserialize", Comment: "IRIDeserialize turns a string into a URI.", Args: []*FunctionVarDef{{"v", "interface{}"}}, Return: []*FunctionVarDef{{"u", "*url.URL"}, {"err", "error"}}, Body: func() string { var b bytes.Buffer b.WriteString("if s, ok := v.(string); ok {\n") b.WriteString("u, err = url.Parse(s)\n") b.WriteString("if err != nil {\n") b.WriteString("err = fmt.Errorf(\"%s cannot be interpreted as IRI\", s)\n") b.WriteString("}\n") b.WriteString("} else {\n") b.WriteString("err = fmt.Errorf(\"%v cannot be interpreted as a string for IRI\", v)\n") b.WriteString("}\n") b.WriteString("return\n") return b.String() }, }, SerializeFn: &FunctionDef{ Name: "IRISerialize", Comment: "IRISerialize turns an IRI into a string", Args: []*FunctionVarDef{{"u", "*url.URL"}}, Return: []*FunctionVarDef{{"s", "string"}}, Body: func() string { var b bytes.Buffer b.WriteString("s = u.String()\n") b.WriteString("return\n") return b.String() }, }, Imports: []string{"net/url"}, }
Functions ¶
func AnyURIValueTypeName ¶
func AnyURIValueTypeName() string
func HasAnyURI ¶
func HasAnyURI(r []RangeReference) bool
func IsActivity ¶
func IsAnyURIValueType ¶
func IsIRIValueType ¶
func IsIRIValueTypeString ¶
func IsOnlyOtherPropertyBesidesIRI ¶
func IsOnlyOtherPropertyBesidesIRI(nonIriIndex int, r []RangeReference) bool
Types ¶
type DomainReference ¶
type FunctionDef ¶
type FunctionDef struct { Name string Comment string Args []*FunctionVarDef Return []*FunctionVarDef Body func() string }
func IRIFuncs ¶
func IRIFuncs() []*FunctionDef
func (*FunctionDef) Generate ¶
func (f *FunctionDef) Generate() string
type FunctionVarDef ¶
func (*FunctionVarDef) Generate ¶
func (f *FunctionVarDef) Generate() string
type InterfaceDef ¶
type InterfaceDef struct { Typename string Comment string // Body is ignored O []string // Other interfaceDef Typenames F []*FunctionDef }
func (*InterfaceDef) Generate ¶
func (i *InterfaceDef) Generate() string
type MemberFunctionDef ¶
type MemberFunctionDef struct { Name string Comment string P *StructDef Args []*FunctionVarDef Return []*FunctionVarDef Body func() string }
func (*MemberFunctionDef) Generate ¶
func (f *MemberFunctionDef) Generate() string
type PackageDef ¶
type PackageDef struct { Name string Comment string Imports []string Defs []*StructDef F []*FunctionDef I []*InterfaceDef Raw string }
func (*PackageDef) Generate ¶
func (p *PackageDef) Generate() string
type PropertyType ¶
type PropertyType struct { Name string URI string Notes string Domain []DomainReference Range []RangeReference // SubpropertyOf is ignorable as long as data is set up correctly SubpropertyOf *PropertyType Functional bool NaturalLanguageMap bool PreferIRIConvenience bool }
type RangeReference ¶
type StructDef ¶
type StructDef struct { Typename string M []*StructMember F []*MemberFunctionDef Compose []*StructDef Comment string }
type StructMember ¶
func (*StructMember) Generate ¶
func (s *StructMember) Generate() string
type Type ¶
type Type struct { Name string URI string Notes string DisjointWith []*Type Extends []*Type Properties []*PropertyType WithoutProperties []*PropertyType }
func (*Type) AllExtendsNames ¶
func (*Type) GetProperties ¶
func (t *Type) GetProperties() []*PropertyType
type ValueType ¶
type ValueType struct { Name string URI string DefinitionType string Zero string ZeroValue string DeserializeFn *FunctionDef SerializeFn *FunctionDef Imports []string }
Click to show internal directories.
Click to hide internal directories.