Go SDK
The Collate Go SDK provides a type-safe, auto-generated client library for Go applications to interact with the Collate API. Built from OpenAPI specifications, it offers strongly typed services for 60+ entity types with automatic pagination, retry logic, and comprehensive error handling. You can find the source code in the GitHub repository. As an open-source project, contributions are always welcome!Requirements
- Go 1.24 or higher
Installation
Quick Start
Basic Connection
Client Configuration Options
| Option | Description | Default |
|---|---|---|
WithToken(token) | JWT Bearer token for authentication | "" |
WithAPIVersion(v) | Override API version | "v1" |
WithRetry(count, wait) | Retry attempts and wait duration | 3 retries, 30s wait |
WithHTTPClient(c) | Custom *http.Client | Default client |
429 (Too Many Requests) and 504 (Gateway Timeout).
Core Functionality
Available Services
The client exposes typed services for all entity types. Here are the most commonly used: Data Assets:Tables, Topics, Dashboards, Pipelines, Charts, Containers, SearchIndexes, StoredProcedures, Queries
Data Organization: Databases, DatabaseSchemas, APICollections, APIEndpoints
Governance: Glossaries, GlossaryTerms, Classifications, Tags, DataProducts, Domains, Policies
Quality: TestCases, TestSuites, TestDefinitions
Services: DatabaseServices, DashboardServices, PipelineServices, MessagingServices, SearchServices, StorageServices
People & Access: Users, Teams, Roles, Bots
Other: IngestionPipelines, EventSubscriptions, MlModels
Standard Operations
All services follow the same consistent pattern with these methods:List
Returns a Go iterator (iter.Seq2) that handles pagination automatically.
GetByID
Retrieve an entity by UUID.GetByName
Retrieve an entity by fully qualified name (FQN).Create
Create a new entity.CreateOrUpdate
Upsert an entity - creates if it doesn’t exist, updates if it does.Patch
Apply JSON Patch operations (RFC 6902) to update specific fields.Delete / DeleteByName
Delete an entity by ID or fully qualified name. Supports soft and hard deletes.Restore
Restore a soft-deleted entity.ListVersions / GetVersion
Access entity version history.Pointer Helpers
Since many fields are optional (pointers), the SDK provides helper functions:Error Handling
APIError type provides:
StatusCode- HTTP status codeCode- API error codeMessage- Error message
Common Use Cases
Create a Database Service, Database, Schema, and Table
Iterate Over All Tables
Update Metadata with Patch
Soft Delete and Restore
Context with Timeout
Best Practices
- Use context timeouts: Always set appropriate timeouts for API calls to avoid hanging requests
- Handle pagination with iterators: Use
rangewithListmethods - the SDK handles cursor-based pagination automatically - Prefer GetByName over GetByID: Fully qualified names are more readable and easier to manage
- Use Patch for partial updates: Prefer
PatchoverCreateOrUpdatewhen updating specific fields to avoid overwriting other data - Check errors with helpers: Use
ometa.IsNotFound()andometa.IsConflict()for common error handling patterns - Soft delete first: Use soft deletes in production and reserve hard deletes for cleanup operations