All test stuff #88

Merged
ABastionOfSanity merged 29 commits from all_test_stuff into main 2023-01-30 21:59:14 +00:00
Showing only changes of commit 9261699745 - Show all commits

View File

@ -70,10 +70,13 @@ func CIDFromJSONBytesUsingIpldPrime(content []byte) (string, error) {
//This is combination of samples for unmarshalling and linking //This is combination of samples for unmarshalling and linking
//see: https://pkg.go.dev/github.com/ipld/go-ipld-prime //see: https://pkg.go.dev/github.com/ipld/go-ipld-prime
np := basicnode.Prototype.Any // Pick a stle for the in-memory data. np := basicnode.Prototype.Any // Pick a stle for the in-memory data.
nb := np.NewBuilder() // Create a builder. nb := np.NewBuilder() // Create a builder.
dagjson.Decode(nb, bytes.NewReader(content)) // Hand the builder to decoding -- decoding will fill it in! err := dagjson.Decode(nb, bytes.NewReader(content)) // Hand the builder to decoding -- decoding will fill it in!
n := nb.Build() // Call 'Build' to get the resulting Node. (It's immutable!) if err != nil {
return "", err
}
n := nb.Build() // Call 'Build' to get the resulting Node. (It's immutable!)
lsys := cidlink.DefaultLinkSystem() lsys := cidlink.DefaultLinkSystem()