Salesforce Go SDK
A production-grade Go SDK for Salesforce with complete API coverage, multiple authentication methods.
Quick Start
go get github.com/PramithaMJ/salesforce/v2
Multiple Auth Methods
OAuth 2.0 refresh token, username-password, and direct access token support
Complete API Coverage
11 service packages covering SObjects, SOQL, Bulk, Composite, Analytics, and more
Bulk Operations
Bulk API 2.0 with ingest and query jobs for high-volume data operations
Query Builders
Fluent SOQL and SOSL query builders with type-safe construction
Composite API
Batch, tree, graph, and collections for efficient multi-operation requests
Built-in Retry
Exponential backoff with configurable retries for resilient operations
Quick Example
main.go
package main
import (
"context"
"fmt"
"os"
"github.com/PramithaMJ/salesforce/v2"
)
func main() {
// Create client with OAuth refresh token
client, _ := salesforce.NewClient(
salesforce.WithOAuthRefresh(
os.Getenv("SF_CLIENT_ID"),
os.Getenv("SF_CLIENT_SECRET"),
os.Getenv("SF_REFRESH_TOKEN"),
),
)
ctx := context.Background()
client.Connect(ctx)
// Query accounts
result, _ := client.Query().Execute(ctx,
"SELECT Id, Name FROM Account LIMIT 5")
for _, record := range result.Records {
fmt.Println(record.StringField("Name"))
}
}
Available Services
| Service | Description | Documentation |
|---|---|---|
SObjects() |
CRUD operations on Salesforce objects | View Docs |
Query() |
SOQL queries with builder pattern | View Docs |
Search() |
SOSL search with builder pattern | View Docs |
Bulk() |
Bulk API 2.0 for large data operations | View Docs |
Composite() |
Batch, tree, graph, collections | View Docs |
Analytics() |
Reports and Dashboards API | View Docs |
Tooling() |
Apex, tests, metadata, debug logs | View Docs |
Chatter() |
Feeds, users, files, groups | View Docs |
UIAPI() |
Records, layouts, picklists | View Docs |
Limits() |
API limits monitoring | View Docs |
Apex() |
Custom Apex REST endpoints | View Docs |