Skip to content

Commit

Permalink
Merge 56db416 into 1342e01
Browse files Browse the repository at this point in the history
  • Loading branch information
galxy25 committed Nov 15, 2018
2 parents 1342e01 + 56db416 commit 6ed3840
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,28 @@ the correct type with NewRecord. Then fill in the fields of the record's
`Write`, which returns the unique ID of the newly created record.

```go
record := client.NewRecord("contact")
record.Data["first_name"] = "Jon"
record.Data["last_name"] = "Snow"
record.Data["phone"] = "555-555-1212"
recordID, err := client.Write(context.Background(), record)
// Create data for a record
var recordData map[string]string
recordType := "contact"
recordData["first_name"] = "Jon"
recordData["last_name"] = "Snow"
recordData["phone"] = "555-555-1212"
// Create optional metadata for the record(metadata can be used for searching)
var metadata map[string]string
matadata["realm"] = "The North"
metadata["pet"] = "Ghost"
// Encrypt and save the record
recordID, err := client.Write(context.Background(), recordType, recordData, metadata)
if err != nil {
//Error handling omitted
}
fmt.Println("Wrote record: " + recordID)
// Read it back out:
// Retrieve the saved record
newRecord, err := client.Read(context.Background(), recordID)
if err != nil {
//Error handling omitted
}
fmt.Println (newRecord.Data["first_name"])

```

## Documentaton
Expand Down

0 comments on commit 6ed3840

Please sign in to comment.