Package Usage: go: github.com/ipld/go-ipld-prime
go-ipld-prime is a series of go interfaces for manipulating IPLD data.
See https://ipld.io/ for more information about the basics
of "What is IPLD?".
Here in the godoc, the first couple of types to look at should be:
These types provide a generic description of the data model.
A Node is a piece of IPLD data which can be inspected.
A NodeAssembler is used to create Nodes.
(A NodeBuilder is just like a NodeAssembler, but allocates memory
(whereas a NodeAssembler just fills up memory; using these carefully
allows construction of very efficient code.)
Different NodePrototypes can be used to describe Nodes which follow certain logical rules
(e.g., we use these as part of implementing Schemas),
and can also be used so that programs can use different memory layouts for different data
(which can be useful for constructing efficient programs when data has known shape for
which we can use specific or compacted memory layouts).
If working with linked data (data which is split into multiple
trees of Nodes, loaded separately, and connected by some kind of
"link" reference), the next types you should look at are:
The most typical use of LinkSystem is to use the linking/cid package
to get a LinkSystem that works with CIDs:
... and then assign the StorageWriteOpener and StorageReadOpener fields
in order to control where data is stored to and read from.
Methods on the LinkSystem then provide the functions typically used
to get data in and out of Nodes so you can work with it.
This root package gathers some of the most important ease-of-use functions
all in one place, but is mostly aliases out to features originally found
in other more specific sub-packages. (If you're interested in keeping
your binary sizes small, and don't use some of the features of this library,
you'll probably want to look into using the relevant sub-packages directly.)
Particularly interesting subpackages include:
Example_createDataAndMarshal shows how you can feed data into a NodeBuilder,
and also how to then hand that to an Encoder.
Often you'll encoding implicitly through a LinkSystem.Store call instead,
but you can do it directly, too.
Example_goValueWithSchema shows how to combine a Go value with an IPLD
schema, which can then be used as an IPLD node.
For more examples and documentation, see the node/bindnode package.
Example_unmarshalData shows how you can use a Decoder
and a NodeBuilder (or NodePrototype) together to do unmarshalling.
Often you'll do this implicitly through a LinkSystem.Load call instead,
but you can do it directly, too.
26 versions
Latest release: almost 2 years ago
1,189 dependent packages
View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/github.com/ipld/go-ipld-prime