Created
January 22, 2020 22:09
-
-
Save vasa-develop/424cf99111333c72f83e617d68934951 to your computer and use it in GitHub Desktop.
SimpleAsWater Tutorial: Hands On IPLD Tutorial: PART 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Map the struct instance to the mapping | |
DocStoreMap[inputID] = employeeObject | |
// Converting the map into JSON object | |
entryJSON, err := json.Marshal(DocStoreMap) | |
if err != nil { | |
fmt.Println(err) | |
} | |
// Display the marshaled JSON object before sending it to IPFS | |
jsonStr := string(entryJSON) | |
fmt.Println("The JSON object of your document entry is:") | |
fmt.Println(jsonStr) | |
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) | |
os.Exit(1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment