supabase

package module
v0.0.0-...-ea87da4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2023 License: MIT Imports: 5 Imported by: 0

README

Supabase-Go 🚀

Go Version go.dev reference GoReportCard License

An unofficial client library for Supabase written in Go. It facilitates authentication and database querying without relying on GoTrue or any Postgresql library.

func main() {
	ctx := context.Background()

	// Create a new Supabase client
	client := supabase.NewClient("<SUPABASE_URL>", "<SUPABASE_ANON_KEY>")

	// Sign in with email and password
	if err := client.SignIn(ctx, "<EMAIL>", "<PASSWORD>"); err != nil {
		log.Fatalf("Failed to sign in: %s", err)
	}

	// Query the database as the authenticated user
	var messages []Message
	if err := client.From("messages").Select("*").To(&messages).Execute(ctx); err != nil {
		log.Fatalf("Failed to retrieve messages: %s", err)
	}

	log.Printf("Successfully retrieved %d messages", len(messages))
}

🎉 Features

  • Compatible with Supabase API 💻
  • Fast and efficient 🚀
  • Supports authentication 🔒
  • Supports querying and filtering data 🔎

💻 Installation

To install Supabase-Go, simply run the following command:

go get github.com/francoisdtm/supabase-go

📚 Examples

Here are a few examples to get you started with Supabase-Go:

... // TODO

🤝 Contributing

We welcome contributions to Supabase-Go! If you find a bug or want to request a new feature, please open an issue. If you want to contribute code, fork the repository and create a pull request.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(url string, key string) *Client

func (*Client) Delete

func (c *Client) Delete(table string) *db.DeleteBuilder

DB: Creates a new delete query

func (*Client) From

func (c *Client) From(table string) *db.SelectBuilder

DB: Creates a new select query

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context) (user *auth.User, err error)

AUTH: Get User details

func (*Client) Insert

func (c *Client) Insert(table string) *db.InsertBuilder

DB: Creates a new insert query

func (*Client) RefreshToken

func (c *Client) RefreshToken(ctx context.Context) (err error)

AUTH: Refresh the access token

func (*Client) SignIn

func (c *Client) SignIn(ctx context.Context, email string, password string) (err error)

AUTH: Sign in an existing user with the given credentials

func (c *Client) SignInWithMagicLink(ctx context.Context, email string) (err error)

AUTH: Send a magic link to the given email address

func (*Client) SignInWithToken

func (c *Client) SignInWithToken(ctx context.Context, token string) (user *auth.User, err error)

AUTH: Sign in with a token

func (*Client) SignOut

func (c *Client) SignOut(ctx context.Context) (err error)

AUTH: Sign out the given user

func (*Client) SignUp

func (c *Client) SignUp(ctx context.Context, email string, password string) (user *auth.User, err error)

AUTH: Sign up a new user with the given credentials

func (*Client) Update

func (c *Client) Update(table string) *db.UpdateBuilder

DB: Creates a new update query

func (*Client) Upsert

func (c *Client) Upsert(table string) *db.InsertBuilder

DB: Creates a new insert query with the upsert option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL