Documentation ¶
Index ¶
- func Fetch(iri *url.URL) (vocab.Type, error)
- func FetchIter(it IterEntry) (vocab.Type, error)
- func FetchIters(it Iter) (vs []vocab.Type, err error)
- func Get(iri *url.URL) (body []byte, err error)
- func IRI(ie IterEntry) (iri *url.URL, err error)
- func IRIs(it Iter) (iris []*url.URL, err error)
- func Post(body []byte, iri *url.URL) (err error)
- func Submit(object vocab.Type, iri *url.URL) error
- type Iter
- type IterEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fetch ¶
Fetch the resource at iri.
If a cached version of the resource at iri is available, that one is returned. If no cached version is available, creates an HTTP GET request that gets the resource.
func FetchIter ¶
Fetch the resource at it.
If a cached version of the resource at iri is available, that one is returned. If no cached version is available, creates an HTTP GET request that gets the resource.
func FetchIters ¶
Fetch all objects from iterator it.
If cached versions of the resources are available, these ones are returned. For each object for which no cached version is available, creates an HTTP GET request that gets the resource.
func IRI ¶
Given ie, return the IRI to that entry.
This will not involve any network request, the information is sourced from ie alone.
func IRIs ¶
Iterate over it and return IRIs to each element in that iterator.
This will not involve any network request, the information is sourced from ie alone.
Types ¶
type Iter ¶
A pimped version of IterEntry that also allows us to get the next item and determine whether we have reached the end. To iterate over some Iter, you would write code like this
for it := getIter(); it != it.End(); it = it.Next() { ... }
func Begin ¶
Return a generic iterator over iterable.
If we don't know how to iterate over iterable or it is in fact not possible, an error is returned.
type IterEntry ¶
type IterEntry interface { // Returns wheter any value is set. HasAny() bool // Returns whether the underlying value is an IRI and not // a full object. IsIRI() bool // Return the underlying IRI. Only call this if IsIRI // returns true. GetIRI() *url.URL // Return the underlying object. Only call this if IsIRI // returns false and HasAny returns true. GetType() vocab.Type }
A single entry of an iterator. Many of the go-fed iterator types implement this interface.
It either contains a vocab.Type instance, an IRI pointing to some object that can be represented as vocab.Type or nothing (in which case HasAny returns false).