#I would like to compare using golang (
1 messages · Page 1 of 1 (latest)
hi @wanton veldt, check out this following code:
package main
import (
"context"
"log"
v1 "github.com/Permify/permify-go/generated/base/v1"
permify "github.com/Permify/permify-go/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/status"
)
func main() {
client, err := permify.NewClient(
permify.Config{
Endpoint: localhost:3478,
},
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
if err != nil {
log.Fatalf("failed to create Permify client: %v", err)
}
ct, err := client.Schema.List(context.Background(), &v1.SchemaListRequest{
TenantId: "t1",
})
if err != nil {
if status.Code(err) == codes.NotFound {
log.Fatalf("Schema not found")
}
log.Fatalf("failed to list schema: %v", err)
}
log.Printf("Schema found: %v", ct)
}
Thank you!