Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/conneroisu/dbpu

Golang database per user for turso.
https://github.com/conneroisu/dbpu

Last synced: 22 days ago
JSON representation

Golang database per user for turso.

Awesome Lists containing this project

README

        

# go-dbpu

Golang database per user for turso db.

## Installation

```bash
go get github.com/conneroisu/dbpu
```

## Usage

See examples for more details.

### Create a new database

The following example creates a new database.

```go
// func CreateDatabase(orgToken string, orgName string, name string, group string) (Db, error) {
package main

import (
"fmt"
"os"
"github.com/conneroisu/dbpu"
"github.com/google/uuid"
)

func main() {
orgToken := os.Getenv("ORG_TOKEN")
orgName := os.Getenv("ORG_NAME")
dbName := uuid.New().String()
db, err := dbpu.CreateDatabase(orgToken, orgName, dbName, "default")
if err != nil {
fmt.Println(err)
}
fmt.Println(db)
}
```