Skip to content

divan/edgedb-go

 
 

Repository files navigation

The Go driver for EdgeDB

Build Status Join GitHub discussions

Installation

$ go get https://github.com/edgedb/edgedb-go

Basic Usage

Follow the EdgeDB tutorial to get EdgeDB installed and minimally configured.

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/edgedb/edgedb-go"
)

func main() {
	opts := edgedb.Options{
		Database: "edgedb",
		User: "edgedb",
		MinConns: 1,
		MaxConns: 4,
	}

	ctx := context.Background()
	pool, err := edgedb.Connect(ctx, opts)
	if err != nil {
		log.Fatal(err)
	}
	defer pool.Close()

	var result string
	err = pool.QueryOne(ctx, "SELECT 'hello EdgeDB!'", &result)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(result)
}

Development

A local installation of EdgeDB is required to run tests. Download EdgeDB from here or build it manually.

To run the test suite run make test. To run lints make lint.

License

edgedb-go is developed and distributed under the Apache 2.0 license.

Packages

No packages published

Languages

  • Go 99.9%
  • Makefile 0.1%