Module ffi

Source
Expand description

Enhanced C FFI (Foreign Function Interface) bindings

This module provides comprehensive C-compatible functions for all Supabase features, allowing the library to be used from other programming languages like C, C++, Python, Go, etc.

§Features

  • Full API coverage: Auth, Database, Storage, Functions, Realtime
  • Async-to-sync bridge for FFI consumers
  • Safe memory management with leak prevention
  • Comprehensive error handling with detailed context
  • Thread-safe operations

§Safety

All FFI functions are marked as unsafe and require careful handling of memory management and string encoding.

§Usage

#include "include/supabase.h"

int main() {
    SupabaseClient* client = supabase_client_new("https://example.supabase.co", "your-key");

    char result[1024];
    SupabaseError error = supabase_auth_sign_in(client, "email@example.com", "password", result, sizeof(result));

    if (error == SUPABASE_SUCCESS) {
        printf("Success: %s\n", result);
    }

    supabase_client_free(client);
    return 0;
}

Structs§

SupabaseClient
Opaque handle to a Supabase client with runtime

Enums§

SupabaseError
Enhanced C-compatible error codes

Functions§

supabase_auth_sign_in
Sign in with email and password
supabase_auth_sign_up
Sign up with email and password
supabase_client_free
Free a Supabase client
supabase_client_new
Create a new Supabase client with async runtime
supabase_database_insert
Execute a database insert operation
supabase_database_select
Execute a database select query
supabase_functions_invoke
Invoke an edge function
supabase_get_last_error
Get the last error message
supabase_storage_list_buckets
List storage buckets