The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Add Kotlin snippets to postgres docs (#20974)
Jan Tennertdc69a218da8b
diff --git a/apps/docs/pages/guides/database/extensions/plv8.mdx b/apps/docs/pages/guides/database/extensions/plv8.mdxindex ae1fd4b018d..3ade38a3688 100644--- a/apps/docs/pages/guides/database/extensions/plv8.mdx+++ b/apps/docs/pages/guides/database/extensions/plv8.mdx@@ -85,6 +85,13 @@ select function_name();const { data, error } = supabase.rpc('function_name')```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+val data = supabase.postgrest.rpc("function_name")+```+</TabPanel></Tabs>diff --git a/apps/docs/pages/guides/database/extensions/postgis.mdx b/apps/docs/pages/guides/database/extensions/postgis.mdxindex 158d9899680..c85e0c8f4dd 100644--- a/apps/docs/pages/guides/database/extensions/postgis.mdx+++ b/apps/docs/pages/guides/database/extensions/postgis.mdx@@ -141,6 +141,25 @@ await supabase.from('restaurants').insert([]);```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+@Serializable+data class Restaurant(+ val name: String,+ val location: String //you could also use a custom type with a custom serializer for more type safety+)+```++```kotlin+val data = supabase.from("restaurants").insert(listOf(+ Restaurant("Supa Burger", "POINT(-73.946823 40.807416)"),+ Restaurant("Supa Pizza", "POINT(-73.94581 40.807475)"),+ Restaurant("Supa Taco", "POINT(-73.945826 40.80629)"),+))+```+</TabPanel></Tabs>@@ -198,6 +217,19 @@ final data = await supabase.rpc('nearby_restaurants',params: {});```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+val data = supabase.postgrest.rpc(+ function = "nearby_restaurants",+ parameters = buildJsonObject { //You can put here any serializable object including your own classes+ put("lat", 40.807313)+ put("lon", -73.946713)+ }+)+```+</TabPanel><TabPanel id="result" label="Result">@@ -284,6 +316,21 @@ final data = await supabase.rpc('restaurants_in_view', params: {});```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+val data = supabase.postgrest.rpc(+ function = "restaurants_in_view",+ parameters = buildJsonObject { //You can put here any serializable object including your own classes+ put("min_lat", 40.807)+ put("min_lon", -73.946)+ put("max_lat", 40.808)+ put("max_lon", -73.945)+ }+)+```+</TabPanel><TabPanel id="result" label="Result">diff --git a/apps/docs/pages/guides/database/full-text-search.mdx b/apps/docs/pages/guides/database/full-text-search.mdxindex 3c00b29a21d..a4aebb2c62b 100644--- a/apps/docs/pages/guides/database/full-text-search.mdx+++ b/apps/docs/pages/guides/database/full-text-search.mdx@@ -136,6 +136,17 @@ final result = await client.eq('title', 'Harry');```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+val data = supabase.from("books").select {+ filter {+ eq("title", "Harry")+ }+}+```+</TabPanel></Tabs>@@ -174,6 +185,17 @@ final result = await client.textSearch('title', "'Harry'");```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+val data = supabase.from("books").select {+ filter {+ textSearch("title", "'Harry'", TextSearchType.NONE)+ }+}+```+</TabPanel></Tabs>@@ -219,6 +241,17 @@ final result = await client.textSearch('description', "'big'");```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+val data = supabase.from("books").select {+ filter {+ textSearch("description", "'big'", TextSearchType.NONE)+ }+}+```+</TabPanel><TabPanel id="data" label="Data">@@ -287,6 +320,23 @@ final result = await client.textSearch('title_description', "little")```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```sql+create function title_description(books) returns text as $$+ select $1.title || ' ' || $1.description;+$$ language sql immutable;+```++```kotlin+val data = supabase.from("books").select {+ filter {+ textSearch("title_description", "title", TextSearchType.NONE)+ }+}+```+</TabPanel><TabPanel id="data" label="Data">@@ -341,6 +391,17 @@ final result = await client.textSearch('description', "'little' & 'big'");```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+val data = supabase.from("books").select {+ filter {+ textSearch("description", "'title' & 'big'", TextSearchType.NONE)+ }+}+```+</TabPanel><TabPanel id="data" label="Data">@@ -394,6 +455,17 @@ final result = await client.textSearch('description', "'little' | 'big'");```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+val data = supabase.from("books").select {+ filter {+ textSearch("description", "'title' | 'big'", TextSearchType.NONE)+ }+}+```+</TabPanel><TabPanel id="data" label="Data">@@ -494,6 +566,17 @@ final result = await client.textSearch('fts', "'little' & 'big'");```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+val data = supabase.from("books").select {+ filter {+ textSearch("fts", "'title' & 'big'", TextSearchType.NONE)+ }+}+```+</TabPanel><TabPanel id="data" label="Data">@@ -552,6 +635,17 @@ final result = await client.textSearch('description', "'big' <-> 'dreams'");```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+val data = supabase.from("books").select {+ filter {+ textSearch("description", "'big' <-> 'dreams'", TextSearchType.NONE)+ }+}+```+</TabPanel></Tabs>@@ -595,6 +689,17 @@ final result = await client.textSearch('description', "'year' <2> 'school'");```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+val data = supabase.from("books").select {+ filter {+ textSearch("description", "'year' <2> 'school'", TextSearchType.NONE)+ }+}+```+</TabPanel></Tabs>@@ -641,6 +746,17 @@ final result = await client.textSearch('description', "'big' & !'little'");```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+val data = supabase.from("books").select {+ filter {+ textSearch("description", "'big' & !'little'", TextSearchType.NONE)+ }+}+```+</TabPanel></Tabs>diff --git a/apps/docs/pages/guides/database/functions.mdx b/apps/docs/pages/guides/database/functions.mdxindex cd6c4b5447b..c6fcf35e80f 100644--- a/apps/docs/pages/guides/database/functions.mdx+++ b/apps/docs/pages/guides/database/functions.mdx@@ -96,6 +96,15 @@ final data = await supabaseReference: [rpc()](../../reference/dart/rpc)+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+val data = supabase.postgrest.rpc("hello_world")+```++Reference: [rpc()](../../reference/kotlin/rpc)+</TabPanel></Tabs>@@ -209,6 +218,17 @@ final data = await supabase.eq('id', 1);```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+val data = supabase.postgrest.rpc("get_planets") {+ filter {+ eq("id", 1)+ }+}+```+</TabPanel></Tabs>@@ -263,6 +283,18 @@ final data = await supabase.rpc('add_planet', params: { 'name': 'Jakku' });```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+val data = supabase.postgrest.rpc(+ function = "add_planet",+ parameters = buildJsonObject { //You can put here any serializable object including your own classes+ put("name", "Jakku")+ }+)+```+</TabPanel></Tabs>diff --git a/apps/docs/pages/guides/database/joins-and-nesting.mdx b/apps/docs/pages/guides/database/joins-and-nesting.mdxindex c1f1ae42529..9848d66b6e9 100644--- a/apps/docs/pages/guides/database/joins-and-nesting.mdx+++ b/apps/docs/pages/guides/database/joins-and-nesting.mdx@@ -137,6 +137,13 @@ const countriesWithCities: CountriesWithCities = datafinal data = await supabase.from('countries').select('id, name, cities(id, name)');```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+val data = supabase.from("countries").select(Columns.raw("id, name, cities(id, name)"))+```+</TabPanel><TabPanel id="graphql" label="GraphQL">@@ -217,6 +224,13 @@ const { data, error } = await supabase.from('teams').select(`final data = await supabase.from('teams').select('id, team_name, users(id, name)');```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+val data = supabase.from("teams").select(Columns.raw("id, team_name, users(id, name)"));+```+</TabPanel><TabPanel id="graphql" label="GraphQL">diff --git a/apps/docs/pages/guides/database/json.mdx b/apps/docs/pages/guides/database/json.mdxindex ddaf6520db1..5b9aba8d385 100644--- a/apps/docs/pages/guides/database/json.mdx+++ b/apps/docs/pages/guides/database/json.mdx@@ -179,6 +179,35 @@ const { data, error } = await supabase.from('books').insert([])```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+@Serializable+data class BookMetadata(+ val description: String,+ val price: Double,+ val ages: List<Int>+)++@Serializable+data class Book(+ val title: String,+ val author: String,+ val metadata: BookMetadata+)+```++```kotlin+val data = supabase.from("books").insert(listOf(+ Book("The Poky Little Puppy", "Janette Sebring Lowrey", BookMetadata("Puppy is slower than other, bigger animals.", 5.95, listOf(3, 6))),+ Book("Tale of Peter Rabbit", "Beatrix Potter", BookMetadata("Rabbit eats some vegetables.", 4.49, listOf(2, 5))),+ Book("Tootle", "Gertrude Crampton", BookMetadata("Little toy train has big dreams.", 3.99, listOf(2, 5))),+ Book("Green Eggs and Ham", "Dr. Seuss", BookMetadata("Sam has changing food preferences and eats unusually colored food.", 7.49, listOf(4, 8))),+ Book("Harry Potter and the Goblet of Fire", "J.K. Rowling", BookMetadata("Fourth year of school starts, big drama ensues.", 24.95, listOf(10, 99)))+))+```+</TabPanel></Tabs>@@ -220,6 +249,19 @@ const { data, error } = await supabase.from('books').select(``)```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+val data = supabase.from("books").select(Columns.raw("""+ title,+ description: metadata->description,+ price: metadata->price,+ low_age: metadata->ages->0,+ high_age: metadata->ages->1+""".trimIndent()))+```+</TabPanel><TabPanel id="result" label="Result">diff --git a/apps/docs/pages/guides/database/tables.mdx b/apps/docs/pages/guides/database/tables.mdxindex 9590fe48157..4fa2dc22b68 100644--- a/apps/docs/pages/guides/database/tables.mdx+++ b/apps/docs/pages/guides/database/tables.mdx@@ -202,22 +202,25 @@ values</TabPanel><TabPanel id="js" label="JavaScript">-```sql-const { data, error } = await supabase- .from('movies')- .insert([{+```js+const { data, error } = await supabase.from('movies').insert([+ {name: 'The Empire Strikes Back',- description: 'After the Rebels are brutally overpowered by the Empire on the ice planet Hoth, Luke Skywalker begins Jedi training with Yoda.'- }, {+ description:+ 'After the Rebels are brutally overpowered by the Empire on the ice planet Hoth, Luke Skywalker begins Jedi training with Yoda.',+ },+ {name: 'Return of the Jedi',- description: 'After a daring mission to rescue Han Solo from Jabba the Hutt, the Rebels dispatch to Endor to destroy the second Death Star.'- }])+ description:+ 'After a daring mission to rescue Han Solo from Jabba the Hutt, the Rebels dispatch to Endor to destroy the second Death Star.',+ },+])```</TabPanel><TabPanel id="dart" label="Dart">-```sql+```dartawait supabase.from('movies').insert([{@@ -229,6 +232,26 @@ await supabase}]);```+</TabPanel>+<TabPanel id="kotlin" label="Kotlin">++```kotlin+@Serializable+data class Movie(+ val name: String,+ val description: String+)+```++```kotlin+supabase+ .from("movies")+ .insert(listOf(+ Movie("The Empire Strikes Back", "After the Rebels are brutally overpowered by the Empire on the ice planet Hoth, Luke Skywalker begins Jedi training with Yoda."),+ Movie("Return of the Jedi", "After a daring mission to rescue Han Solo from Jabba the Hutt, the Rebels dispatch to Endor to destroy the second Death Star."),+ ))+```+</TabPanel></Tabs>diff --git a/i18n/README.tr.md b/i18n/README.tr.mdindex 4f8f3be2762..9a9c7ecb335 100644--- a/i18n/README.tr.md+++ b/i18n/README.tr.md@@ -19,7 +19,7 @@- [x] Veritabanı Fonksiyonları. [Dokümanlar](https://supabase.com/docs/guides/database/functions)- [x] Kenar İşlevleri [Dokümanlar](https://supabase.com/docs/guides/functions)- [x] Dosya Depolama. [Docs](https://supabase.com/docs/guides/storage)-- [X] AI + Vektör / Gömme Araçları. [Dokümanlar](https://supabase.com/docs/guides/ai)+- [x] AI + Vektör / Gömme Araçları. [Dokümanlar](https://supabase.com/docs/guides/ai)- [x] Gösterge Tablosu