Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
SimpleAsWater Tutorial: Hands On IPLD Tutorial: PART 2
// Map the struct instance to the mapping
DocStoreMap[inputID] = employeeObject
// Converting the map into JSON object
entryJSON, err := json.Marshal(DocStoreMap)
if err != nil {
// Display the marshaled JSON object before sending it to IPFS
jsonStr := string(entryJSON)
fmt.Println("The JSON object of your document entry is:")
start := time.Now()
// Dag PUT operation which will return the CID for futher access or pinning etc.
cid, err := sh.DagPut(entryJSON, "json", "cbor")
elapsed := time.Since(start)
if err != nil {
fmt.Fprintf(os.Stderr, "error: %s", err)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment