xata go
1.0.0

XATA.IO數據庫的簡單Golang客戶端。
XATA是一個無服務器數據庫,與電子表格一樣易於使用,具有PostGressQL的數據完整性以及Elasticsearch的搜索和分析功能。
要安裝,運行:
假設API鍵被設置為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
}API密鑰也可以作為客戶端構造函數的參數提供:
workspaceCli , err := xata . NewWorkspacesClient ( xata . WithAPIKey ( "my-api-key" ))要了解有關XATA的更多信息,請訪問xata.io。
make test make integration-testmake lint請諮詢有關代碼生成的頁面以及如何添加新客戶端以了解有關SDK架構的更多信息。