pub struct Supabase {
pub url: String,
pub key: String,
pub http_client: Client,
pub auth: Auth,
pub options: ClientOptions,
}
Expand description
The main entry point for the Supabase Rust client
Fields§
§url: String
The base URL for the Supabase project
key: String
The anonymous API key for the Supabase project
http_client: Client
HTTP client used for requests
auth: Auth
Auth client for user management and authentication
options: ClientOptions
Client options
Implementations§
Source§impl Supabase
impl Supabase
Sourcepub fn new_with_options(
supabase_url: &str,
supabase_key: &str,
options: ClientOptions,
) -> Self
pub fn new_with_options( supabase_url: &str, supabase_key: &str, options: ClientOptions, ) -> Self
Create a new Supabase client with custom options
§Arguments
supabase_url
- The base URL for your Supabase projectsupabase_key
- The anonymous API key for your Supabase projectoptions
- Custom client options
§Example
use supabase_rust::{Supabase, ClientOptions};
let options = ClientOptions::default().with_auto_refresh_token(true);
let supabase = Supabase::new_with_options(
"https://your-project-url.supabase.co",
"your-anon-key",
options
);
Sourcepub fn auth(&self) -> &Auth
pub fn auth(&self) -> &Auth
Get a reference to the auth client for user management and authentication
Sourcepub fn from(&self, table: &str) -> PostgrestClient
pub fn from(&self, table: &str) -> PostgrestClient
Sourcepub fn rpc(&self, function_name: &str, params: Value) -> PostgrestClient
pub fn rpc(&self, function_name: &str, params: Value) -> PostgrestClient
Execute a Postgres function via RPC
§Arguments
function_name
- The name of the function to callparams
- Parameters to pass to the function
§Example
use supabase_rust::Supabase;
use serde_json::json;
let supabase = Supabase::new("https://your-project-url.supabase.co", "your-anon-key");
let result = supabase.rpc("calculate_total", json!({"user_id": 123}));
Auto Trait Implementations§
impl Freeze for Supabase
impl !RefUnwindSafe for Supabase
impl Send for Supabase
impl Sync for Supabase
impl Unpin for Supabase
impl !UnwindSafe for Supabase
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more