forked from supabase-community/supabase-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient_test.go
40 lines (34 loc) · 924 Bytes
/
client_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package supabase_test
import (
"fmt"
"testing"
"github.com/supabase-community/supabase-go"
)
const (
API_URL = "https://your-company.supabase.co"
API_KEY = "your-api-key"
)
func TestFrom(t *testing.T) {
client, err := supabase.NewClient(API_URL, API_KEY, nil)
if err != nil {
fmt.Println("cannot initalize client", err)
}
data, count, err := client.From("countries").Select("*", "exact", false).Execute()
fmt.Println(string(data), err, count)
}
func TestRpc(t *testing.T) {
client, err := supabase.NewClient(API_URL, API_KEY, nil)
if err != nil {
fmt.Println("cannot initalize client", err)
}
result := client.Rpc("hello_world", "", nil)
fmt.Println(result)
}
func TestStorage(t *testing.T) {
client, err := supabase.NewClient(API_URL, API_KEY, nil)
if err != nil {
fmt.Println("cannot initalize client", err)
}
result, err := client.Storage.GetBucket("bucket-id")
fmt.Println(result, err)
}