https://github.com/xataio/xata-go
Go SDK for xata.io
https://github.com/xataio/xata-go
database full-text-search go hacktoberfest openai postgres sdk sdk-go vector-search xata xata-io
Last synced: 4 months ago
JSON representation
Go SDK for xata.io
- Host: GitHub
- URL: https://github.com/xataio/xata-go
- Owner: xataio
- License: apache-2.0
- Created: 2023-09-28T11:42:30.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-22T07:45:30.000Z (over 2 years ago)
- Last Synced: 2025-06-23T11:07:25.981Z (about 1 year ago)
- Topics: database, full-text-search, go, hacktoberfest, openai, postgres, sdk, sdk-go, vector-search, xata, xata-io
- Language: Go
- Homepage:
- Size: 446 KB
- Stars: 9
- Watchers: 3
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Golang SDK for Xata
Simple Golang client for xata.io databases.
Xata is a Serverless Database that is as easy to use as a spreadsheet, has the
data integrity of PostgresSQL, and the search and analytics functionality of
Elasticsearch.
To install, run:
Assuming that the API key is set as an env var: `XATA_API_KEY=api-key-value`
```Go
package main
import (
"context"
"fmt"
"log"
"github.com/xataio/xata-go/xata"
)
func main() {
workspaceCli, err := xata.NewWorkspacesClient()
if err != nil {
log.Fatal(err)
}
resp, err := workspaceCli.List(context.Background())
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", *resp.Workspaces[0])
// Output: api.GetWorkspacesListResponseWorkspacesItem{ID:"Alice-s-workspace-abcd", Name:"Alice's workspace", Slug:"Alice-s-workspace", Role:0x1}
item := *resp.Workspaces[0]
fmt.Printf("%s\n", item.Role.String())
// Output: owner
}
```
The API key can also be provided as a parameter to the client constructor:
```Go
workspaceCli, err := xata.NewWorkspacesClient(xata.WithAPIKey("my-api-key"))
```
To learn more about Xata, visit [xata.io](https://xata.io).
- API Reference: https://xata.io/docs/rest-api/contexts#openapi-specifications
## Development
### Requirements
- Go 1.21.0+
- Docker
- Make
- [fern](https://docs.buildwithfern.com/overview/cli/cli) (only if auto code generation is needed)
### Tests
```shell
make test
```
```shell
make integration-test
```
### Linting
```shell
make lint
```
### Codegen
Please consult the pages about [code generation](code-generation.md) and [how to add a new client](add-new-feature.md) to learn more about the architecture of the SDK.