iri

package module
v0.0.0-...-97898e1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: MIT Imports: 7 Imported by: 0

README

Internationalized Resource Identifier

The library implements IRI data type.

Support is discontinued, use https://github.com/fogfish/curie

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID struct {
	IRI IRI `dynamodbav:"id" json:"id"`
}

ID is type tagging built over IRI type, unique identity of a thing.

  type MyStruct struct {
		iri.ID
	}

func New

func New(iri string, args ...interface{}) ID

New parses a compact IRI string

func (ID) Eq

func (iri ID) Eq(x ID) bool

Eq return true if IRI equals

func (ID) Heir

func (iri ID) Heir(segment string) ID

Heir returns a IRI that descendant of this one.

func (ID) Identity

func (iri ID) Identity() ID

Identity return unique identity, required by Thing interface

func (ID) Parent

func (iri ID) Parent(rank ...int) ID

Parent returns a IRI that is prefix of this one

func (ID) Path

func (iri ID) Path() string

Path converts IRI to the path, joins IRI segments

func (ID) Prefix

func (iri ID) Prefix(rank ...int) string

Prefix return IRI prefix

func (ID) Segments

func (iri ID) Segments() []string

Segments returns segments of IRI

func (ID) Suffix

func (iri ID) Suffix(rank ...int) string

Suffix return IRI suffix

func (ID) ToIRI

func (iri ID) ToIRI() *IRI

ToIRI converts ID to IRI type

type IRI

type IRI struct {
	Seq []string
}

IRI is Internationalized Resource Identifier https://en.wikipedia.org/wiki/Internationalized_Resource_Identifier

func NewIRI

func NewIRI(iri string, args ...interface{}) IRI

NewIRI builds compact IRI from string

func (IRI) Eq

func (iri IRI) Eq(x IRI) bool

Eq return true if two IRI equals

func (IRI) Heir

func (iri IRI) Heir(segment string) IRI

Heir returns a IRI that descendant of this one.

func (IRI) MarshalDynamoDBAttributeValue

func (iri IRI) MarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error

MarshalDynamoDBAttributeValue `IRI ⟼ "prefix/suffix"`

func (IRI) MarshalJSON

func (iri IRI) MarshalJSON() ([]byte, error)

MarshalJSON `IRI ⟼ "prefix:suffix"`

func (IRI) Parent

func (iri IRI) Parent(rank ...int) IRI

Parent returns a IRI that is prefix of this one

func (IRI) Prefix

func (iri IRI) Prefix(rank ...int) string

Prefix return IRI prefix

func (IRI) Segments

func (iri IRI) Segments() []string

Segments return elements

func (IRI) String

func (iri IRI) String() string

String ...

func (IRI) Suffix

func (iri IRI) Suffix(rank ...int) string

Suffix return IRI suffix

func (*IRI) UnmarshalDynamoDBAttributeValue

func (iri *IRI) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error

UnmarshalDynamoDBAttributeValue `"prefix/suffix" ⟼ IRI`

func (*IRI) UnmarshalJSON

func (iri *IRI) UnmarshalJSON(b []byte) error

UnmarshalJSON `"prefix:suffix" ⟼ IRI`

type Thing

type Thing interface {
	Identity() ID
}

Thing is "interface tag" allows usage of IRI abstraction in other interfaces

Jump to

Keyboard shortcuts

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