[B4X] Supabase - The Open Source Firebase alternative
Supabase is an open source Firebase alternative. It provides all the backend services you need to build a product. Supabase uses Postgres database with real-time capabilities. Basically, supabase provides an interface to manage postgres database that you can use to create table and insert, edit...
www.b4x.com
It is possible to create a new data record and return it directly.
Use the
SelectData
property
B4X:
Dim Insert As Supabase_DatabaseInsert = xSupabase.Database.InsertData
Insert.From("users")
Insert.Upsert 'Works with upsert too
Insert.SelectData
Dim InsertMap As Map = CreateMap("id":"492422e5-4188-4b40-9324-fee7c46be527","username":"Alex")
Wait For (Insert.Insert(InsertMap).Execute) Complete (Result As SupabaseDatabaseResult)
xSupabase.Database.PrintTable(Result)
The same works if you update a record
B4X:
Dim Update As Supabase_DatabaseUpdate = xSupabase.Database.UpdateData
Update.From("users")
Update.Update(CreateMap("username":"Alex"))
Update.SelectData
Update.Eq(CreateMap("id":"492422e5-4188-4b40-9324-fee7c46be527"))
Wait For (Update.Execute) Complete (Result As SupabaseDatabaseResult)
xSupabase.Database.PrintTable(Result)