forked from jhagas/ESPSupabase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
documentation and bumping version number
- Loading branch information
Jhagas
committed
Apr 13, 2023
1 parent
0ea5c95
commit fb1078f
Showing
13 changed files
with
563 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## Database Playground | ||
|
||
Use this as a template to explore your supabase feature! Please make sure to enable RLS, you can enhance security with user authentication feature |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,35 +6,61 @@ Supabase db; | |
|
||
// Put your supabase URL and Anon key here... | ||
// Because Login already implemented, there's no need to use secretrole key | ||
String supabase_url = "https://bzdazgjthqumbxiexchy.supabase.co"; | ||
String anon_key = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImJ6ZGF6Z2p0aHF1bWJ4aWV4Y2h5Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2ODExNjAwNTcsImV4cCI6MTk5NjczNjA1N30.nQb4GMqJY9DGt-i7gsd4DSSHmBwo7ucUOJHqhp5OlHE"; | ||
String supabase_url = ""; | ||
String anon_key = ""; | ||
|
||
// put your WiFi credentials (SSID and Password) here | ||
const char* ssid = "FALKO 1"; | ||
const char* psswd = "12345678"; | ||
const char *ssid = ""; | ||
const char *psswd = ""; | ||
|
||
// Put Supabase account credentials here | ||
const String email = "[email protected]"; | ||
const String password = "thisispassword"; | ||
const String email = ""; | ||
const String password = ""; | ||
|
||
void setup() { | ||
|
||
// Put your JSON that you want to insert rows | ||
// You can also use library like ArduinoJson generate this | ||
String JSON = ""; | ||
|
||
bool upsert = false; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(9600); | ||
|
||
// Connecting to Wi-Fi | ||
Serial.print("Connecting to WiFi"); | ||
WiFi.begin(ssid, psswd); | ||
while (WiFi.status() != WL_CONNECTED) { | ||
while (WiFi.status() != WL_CONNECTED) | ||
{ | ||
delay(100); | ||
Serial.print("."); | ||
} | ||
Serial.println("Connected!"); | ||
|
||
// Beginning Supabase Connection | ||
db.begin(supabase_url, anon_key); | ||
|
||
// Logging in with your account you made in Supabase | ||
db.login_email(email, password); | ||
|
||
String read = db.from("examples").select("*").eq("role","praktikan").order("date","asc", true).limit(1).doSelect(); | ||
// Select query with filter and order, limiting the result is mandatory here | ||
String read = db.from("table").select("*").eq("column", "value").order("column", "asc", true).limit(1).doSelect(); | ||
Serial.println(read); | ||
|
||
// Reset Your Query before doing everything else | ||
db.urlQuery_reset(); | ||
|
||
// Join operation with other table that connected via PK or FK | ||
String read = db.from("table").select("*, other_table(other_table_column1, other_table_column2, another_table(*))").order("column", "asc", true).limit(1).doSelect(); | ||
Serial.println(read); | ||
db.urlQuery_reset(); | ||
|
||
// Insert operation | ||
int HTTPresponseCode = db.insert("table", JSON, upsert); | ||
} | ||
|
||
void loop() { | ||
void loop() | ||
{ | ||
delay(10); | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#include <Arduino.h> | ||
#include <ESP32_Supabase.h> | ||
#include <WiFi.h> | ||
|
||
Supabase db; | ||
|
||
// Put your supabase URL and Anon key here... | ||
// Because Login already implemented, there's no need to use secretrole key | ||
String supabase_url = ""; | ||
String anon_key = ""; | ||
|
||
// put your WiFi credentials (SSID and Password) here | ||
const char *ssid = ""; | ||
const char *psswd = ""; | ||
|
||
// Put Supabase account credentials here | ||
const String email = ""; | ||
const String password = ""; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(9600); | ||
|
||
// Connecting to Wi-Fi | ||
Serial.print("Connecting to WiFi"); | ||
WiFi.begin(ssid, psswd); | ||
while (WiFi.status() != WL_CONNECTED) | ||
{ | ||
delay(100); | ||
Serial.print("."); | ||
} | ||
Serial.println("Connected!"); | ||
|
||
// Beginning Supabase Connection | ||
db.begin(supabase_url, anon_key); | ||
|
||
// Logging in with your account you made in Supabase | ||
db.login_email(email, password); | ||
|
||
// Select query with filter and order, limiting the result is mandatory here | ||
String read = db.from("examples").select("*").eq("column", "value").order("column", "asc", true).limit(1).doSelect(); | ||
Serial.println(read); | ||
|
||
// Reset Your Query before doing everything else | ||
db.urlQuery_reset(); | ||
|
||
// Join operation with other table that connected via PK or FK | ||
String read = db.from("examples").select("*, other_table(other_table_column1, other_table_column2, another_table(*))").order("column", "asc", true).limit(1).doSelect(); | ||
Serial.println(read); | ||
db.urlQuery_reset(); | ||
} | ||
|
||
void loop() | ||
{ | ||
delay(10); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <Arduino.h> | ||
#include <ESP32_Supabase.h> | ||
#include <WiFi.h> | ||
|
||
Supabase db; | ||
|
||
// Put your target table here | ||
String table = ""; | ||
|
||
// Put your JSON that you want to insert rows | ||
// You can also use library like ArduinoJson generate this | ||
String JSON = ""; | ||
|
||
bool upsert = false; | ||
|
||
void setup() { | ||
Serial.begin(9600); | ||
|
||
Serial.print("Connecting to WiFi"); | ||
WiFi.begin("ssid", "password"); | ||
while (WiFi.status() != WL_CONNECTED) { | ||
delay(100); | ||
Serial.print("."); | ||
} | ||
Serial.println("Connected!"); | ||
|
||
int code = db.update("table").eq("column", "value").doUpdate(JSON); | ||
Serial.println(code); | ||
db.urlQuery_reset(); | ||
} | ||
|
||
void loop() { | ||
delay(10); | ||
} |
Oops, something went wrong.