supabase-client-graphql
GraphQL client for supabase-client, powered by the pg_graphql PostgreSQL extension.
Note: This crate is part of the
supabase-client-sdkworkspace. Most users should depend onsupabase-client-sdkwith thegraphqlfeature rather than using this crate directly.
Key Features
SupabaseClientGraphqlExtextension trait — adds.graphql()toSupabaseClientGraphqlClient— HTTP client for the/graphql/v1endpoint- Raw query execution with variables and operation names
- Fluent
QueryBuilderfor Relay-style collection queries with filtering, ordering, pagination, and total count - Fluent
MutationBuilderfor insert, update, and delete mutations - Rich filter support:
eq,neq,gt,gte,lt,lte,in,is,like,ilike,startsWith, and composableand/or/not - Cursor-based (
first/after,last/before) and offset pagination set_auth()to override the default token for subsequent requests
Usage
Raw Query
use SupabaseClientGraphqlExt;
let graphql = client.graphql?;
let response = graphql.execute_raw.await?;
Collection Query (Builder)
use ;
use json;
let graphql = client.graphql?;
let connection = graphql.collection
.select
.filter
.order_by
.first
.total_count
..await?;
for edge in &connection.edges
Insert Mutation
use SupabaseClientGraphqlExt;
use json;
let graphql = client.graphql?;
let result = graphql.insert_into
.objects
.returning
..await?;
Update Mutation
use ;
let graphql = client.graphql?;
let result = graphql.update
.set
.filter
.at_most
.returning
..await?;
Delete Mutation
use ;
let graphql = client.graphql?;
let result = graphql.delete_from
.filter
.at_most
.returning
..await?;
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.