Top 5.5% forks on proxy.golang.org
proxy.golang.org : github.com/thingful/hypercat-go
Package hypercat provides a minimal library for working with Hypercat documents (see http://www.hypercat.io). It is only compatible with the upcoming Hypercat 3.0 release, so will not work properly with either Hypercat 1.1 or 2.0 documents. The package is documented at: To import the library use: Which will import the library and make available a `hypercat` namespace to your application. To create a new Hypercat catalogue use: This creates a new catalogue and sets the standard `hasDescription` rel to the given name. we can then add metadata relations to it like this: The package defines rels and vals for the standard rels/vals contained within the Hypercat standard, but to add custom metadata you can simply do this: To create a new resource item use: This sets the `href` of the item and the required `hasDescription` metadata rel. You can add more metadata like this: This item can then be added to the catalogue like this: The `cat` item can then be marshalled to JSON using the standard `encoding/json` package: Similarly we can use `Unmarshal` to convert a supplied JSON document into a struct to work with: There is a convenience method that allows you to parse a Hypercat struct directly from any io.Reader, e.g.:
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/thingful/hypercat-go
License: MIT
Latest release: over 9 years ago
First release: over 9 years ago
Namespace: github.com/thingful
Stars: 3 on GitHub
Forks: 3 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 7 days ago