From fce76a9aed5204078b505726bd156f900150f8f3 Mon Sep 17 00:00:00 2001 From: Amber Verma Date: Fri, 28 Jun 2024 21:26:59 -0400 Subject: [PATCH] chore: Update documentation to clarify relationship queries --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 2a9c738..dec9556 100644 --- a/README.md +++ b/README.md @@ -186,6 +186,29 @@ if err != nil { } ``` +### Handling Relationship Queries + +When querying Salesforce objects, it's common to access fields that are related through parent-child or lookup relationships. For instance, querying `Account.Name` with related `Contact` might look like this: + +##### Example SOQL Query +```sql +SELECT Id, Account.Name FROM Contact +``` + +#### Corresponding Go Structs +To effectively handle the data returned by this query, define your Go structs as follows: + +```go +type ContentDocumentLink struct { + Id string + Account Account +} + +type Account struct { + Name string +} +``` + ## SObject Single Record Operations Insert, Update, Upsert, or Delete one record at a time