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架构的更多信息。