Skip to content

supabase-community/functions-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

16 Commits

functions-go

Golang client library to interact with Supabase Functions.

Quick start

Installation

Install the package using:

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

Usage

The following example demonstrates how to create a client, marshal data into JSON, and make a request to execute a function on the server.

package main import ( "fmt""log""github.com/supabase-community/functions-go" ) funcmain(){client:=functions.NewClient("https://abc.supabase.co/functions/v1", "<service-token>", nil) // Define your data structtypePoststruct{Titlestring`json:"title"`Contentstring`json:"content"` } post:=Post{Title: "Hello, world!", Content: "This is a new post."} // Invoke the function with the post dataresponse, err:=client.Invoke("createPost", post) iferr!=nil{log.Fatal(err) } fmt.Println("Response from server:", response) }

This code will marshal the Post struct into JSON, send it to the createPost function, and print the response.

License

This repository is licensed under the MIT License.

Credits

For further inspiration and a JavaScript-based client, visit:

About

Golang client library to interact with Supabase Functions.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •