Go SDK: Migrate from V1 to V2
Go SDK: Migrate from V1 to V2
Go SDK: Migrate from V1 to V2
Skyflow Go SDK v2 introduces a new authentication model, multi-vault support via a functional options pattern, native Go data structures, and richer error diagnostics. This guide walks through the key changes with before-and-after code examples, focuses on Insert end-to-end, then shows how the same pattern applies to other operations. A final section covers the v2.1+ field name normalization, which is backward compatible.
V1 required a token provider function. V2 lets you choose from five credential types.
V1:
V2:
Use only one authentication method per credentials object.
V2 uses a functional options pattern for client construction and supports multiple vault configurations per client instance. Log levels are now per-instance instead of global.
V1:
V2 (single vault):
V2 (multiple vaults):
Key changes:
VaultURL is replaced by ClusterId (derived from your vault URL).Env is now required. Supported values: common.DEV, common.SANDBOX, common.PROD.V2 replaces third-party JSON objects with native Go maps and slices. Requests use the typed common.InsertRequest struct.
V1:
V2:
V1 response:
V2 response:
Every vault operation in v2 follows the same pattern: pass a typed request struct and options to the corresponding method on the vault service. The snippets below show v2 request construction.
Get:
Update:
Delete:
Detokenize:
Query:
V2 replaces the v1 monolithic options struct with operation-specific options structs that you populate inline using Go’s idiomatic struct literal syntax.
V1:
V2:
The same pattern applies to UpsertOptions, UpdateOptions, DeleteOptions, and GetOptions.
V2 errors carry more context to help with debugging.
V1:
V2:
Use the requestId field when contacting Skyflow Support — it uniquely identifies the request for faster diagnosis.
v2.1.0 updates credential and response field names to follow camelCase conventions. Both old and new forms are permanently accepted.
Credential field names:
The credentials JSON file accepts both the legacy and new key names.
Response field names:
Response maps now use SkyflowId (PascalCase). The legacy keys are still present for backward compatibility but are deprecated.
For the full list of changes, see the Go SDK releases on GitHub.
If you hit issues during migration, contact Skyflow Support and include the requestId from any failed call.