Giter Site home page Giter Site logo

xata-go's Introduction

Xata

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

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:

workspaceCli, err := xata.NewWorkspacesClient(xata.WithAPIKey("my-api-key"))

To learn more about Xata, visit xata.io.

Development

Requirements

  • Go 1.21.0+
  • Docker
  • Make
  • fern (only if auto code generation is needed)

Tests

make test
make integration-test

Linting

make lint

Codegen

Please consult the pages about code generation and how to add a new client to learn more about the architecture of the SDK.

xata-go's People

Contributors

omerdemirok avatar philkra avatar deverts avatar odemirok avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.