https://github.com/stellaraf/go-sfdc
Salesforce REST & SOQL client for Golang. Note: Mostly tailored to Stellar's specific needs, but should work for others.
https://github.com/stellaraf/go-sfdc
go salesforce
Last synced: over 1 year ago
JSON representation
Salesforce REST & SOQL client for Golang. Note: Mostly tailored to Stellar's specific needs, but should work for others.
- Host: GitHub
- URL: https://github.com/stellaraf/go-sfdc
- Owner: stellaraf
- License: bsd-3-clause-clear
- Created: 2023-06-06T20:32:02.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-23T16:03:21.000Z (over 1 year ago)
- Last Synced: 2025-02-23T17:21:47.495Z (over 1 year ago)
- Topics: go, salesforce
- Language: Go
- Homepage:
- Size: 119 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

## `go-sfdc`
[](https://github.com/stellaraf/go-sfdc/actions/workflows/tests.yml) [](https://pkg.go.dev/go.stellar.af/go-sfdc) [](https://github.com/stellaraf/go-sfdc/tags)
## Installation
```
go get -u go.stellar.af/go-sfdc
```
## Testing Environment Variables
The following environment variables must be set (and valid) for tests to run.
| Key | Description |
| :--------------------------- | :--------------------------------------------------- |
| `SFDC_CLIENT_ID` | Connected App OAuth2 Client ID (Consumer Key) |
| `SFDC_CLIENT_SECRET` | Connected App OAuth2 Client Secret (Consumer Secret) |
| `SFDC_ENCRYPTION_PASSPHRASE` | AES-256 key for encrypting cache values |
| `SFDC_AUTH_URL` | Salesforce Authentication URL |
| `SFDC_TEST_DATA` | JSON string of test data, see below |
### Test Data
The following values are used in unit tests to fetch and validate data through the `go-sfdc` client methods.
| Key | Description |
| :---------------------- | :------------------------------------------------------------------------------------------- |
| `accountId` | ID of pre-existing Account object |
| `userId` | ID of pre-existing User account |
| `groupId` | ID of pre-existing group (Queue) |
| `accountName` | Name of Account used in the `accountId` field |
| `contactId` | ID of pre-existing contact that is associated with the Account used in the `accountId` field |
| `accountCustomFieldKey` | Field name of a custom field on the Account object |
| `caseCustomFieldKey` | Field name of a custom field on the Case object |
| `userEmail` | Email address of the User used in the `userId` field |
| `serviceContractId` | ID of pre-existing Service Contract object |
| `leadId` | ID of pre-existing Lead object |
| `picklistField` | API Name of pre-existing Picklist. Cannot be a managed Picklist. |
| `picklistObject` | API Name of pre-existing object that contains the Picklist referenced in `picklistField`. |
#### Example
```json
{
"accountId": "001A000001abcde123",
"userId": "005A000001xyz7890",
"groupId": "00G1A00000abcdef12",
"accountName": "Acme Corp, Inc.",
"contactId": "003A000001pqrst456",
"accountCustomFieldKey": "go_sfdc_Test_Field__c",
"caseCustomFieldKey": "go_sfdc_Test_Field__c",
"userEmail": "person@example.com",
"serviceContractId": "0SCA00000lmnop789"
}
```