Struct Supabase

Source
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

Source

pub fn new(supabase_url: &str, supabase_key: &str) -> Self

Create a new Supabase client

§Arguments
  • supabase_url - The base URL for your Supabase project
  • supabase_key - The anonymous API key for your Supabase project
§Example
use supabase_rust::Supabase;

let supabase = Supabase::new("https://your-project-url.supabase.co", "your-anon-key");
Source

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 project
  • supabase_key - The anonymous API key for your Supabase project
  • options - 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
);
Source

pub fn auth(&self) -> &Auth

Get a reference to the auth client for user management and authentication

Source

pub fn from(&self, table: &str) -> PostgrestClient

Create a new PostgrestClient for database operations on a specific table or view

§Arguments
  • table - The name of the table or view
§Example
use supabase_rust::Supabase;

let supabase = Supabase::new("https://your-project-url.supabase.co", "your-anon-key");
let query = supabase.from("users");
Source

pub fn storage(&self)

Create a client for the Storage API

Source

pub fn realtime(&self)

Create a client for the Realtime API

Source

pub fn functions(&self)

Create a client for the Edge Functions API

Source

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 call
  • params - 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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T