Categorygithub.com/supabase-community/postgrest-go
modulepackage
0.0.11
Repository: https://github.com/supabase-community/postgrest-go.git
Documentation: pkg.go.dev

# README

Postgrest GO

golangci-lint CodeFactor

Golang client for PostgREST. The goal of this library is to make an "ORM-like" restful interface.

Documentation

Full documentation can be found here.

Quick start

Install

go get github.com/supabase-community/postgrest-go

Usage

package main

import (
	"fmt"

	"github.com/supabase-community/postgrest-go"
)

func main() {
	client := postgrest.NewClient("http://localhost:3000/rest/v1", "", nil)
	if client.ClientError != nil {
		panic(client.ClientError)
	}

	result := client.Rpc("add_them", "", map[string]int{"a": 12, "b": 3})
	if client.ClientError != nil {
		panic(client.ClientError)
	}

	fmt.Println(result)
}

Testing

Some tests are implemented to run against mocked Postgrest endpoints. Optionally, tests can be run against an actual Postgrest instance by setting a POSTGREST_URL environment variable to the fully-qualified URL to a Postgrest instance, and, optionally, an API_KEY environment variable (if, for example, testing against a local Supabase instance).

A script is included in the test directory that can be used to seed the test database.

To run all tests:

go test ./...

License

This repo is licensed under the Apache License.

Sponsors

We are building the features of Firebase using enterprise-grade, open source products. We support existing communities wherever possible, and if the products don’t exist we build them and open source them ourselves. Thanks to these sponsors who are making the OSS ecosystem better for everyone.

New Sponsor

# Packages

No description provided by the author

# Functions

NewClient constructs a new client given a URL to a Postgrest instance.

# Variables

DefaultOrderOpts is the default set of options used by Order.

# Structs

No description provided by the author
ExecuteError is the error response format from postgrest.
FilterBuilder describes a builder for a filtered result set.
OrderOpts describes the options to be provided to Order.
QueryBuilder describes a builder for a query.