diff --git a/apps/docs/pages/guides/database/extensions/plv8.mdx b/apps/docs/pages/guides/database/extensions/plv8.mdx index 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') ``` + + + +```kotlin +val data = supabase.postgrest.rpc("function_name") +``` + diff --git a/apps/docs/pages/guides/database/extensions/postgis.mdx b/apps/docs/pages/guides/database/extensions/postgis.mdx index 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([ ]); ``` + + + +```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)"), +)) +``` + @@ -198,6 +217,19 @@ final data = await supabase.rpc('nearby_restaurants',params: { }); ``` + + + +```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) + } +) +``` + @@ -284,6 +316,21 @@ final data = await supabase.rpc('restaurants_in_view', params: { }); ``` + + + +```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) + } +) +``` + diff --git a/apps/docs/pages/guides/database/full-text-search.mdx b/apps/docs/pages/guides/database/full-text-search.mdx index 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'); ``` + + + +```kotlin +val data = supabase.from("books").select { + filter { + eq("title", "Harry") + } +} +``` + @@ -174,6 +185,17 @@ final result = await client .textSearch('title', "'Harry'"); ``` + + + +```kotlin +val data = supabase.from("books").select { + filter { + textSearch("title", "'Harry'", TextSearchType.NONE) + } +} +``` + @@ -219,6 +241,17 @@ final result = await client .textSearch('description', "'big'"); ``` + + + +```kotlin +val data = supabase.from("books").select { + filter { + textSearch("description", "'big'", TextSearchType.NONE) + } +} +``` + @@ -287,6 +320,23 @@ final result = await client .textSearch('title_description', "little") ``` + + + +```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) + } +} +``` + @@ -341,6 +391,17 @@ final result = await client .textSearch('description', "'little' & 'big'"); ``` + + + +```kotlin +val data = supabase.from("books").select { + filter { + textSearch("description", "'title' & 'big'", TextSearchType.NONE) + } +} +``` + @@ -394,6 +455,17 @@ final result = await client .textSearch('description', "'little' | 'big'"); ``` + + + +```kotlin +val data = supabase.from("books").select { + filter { + textSearch("description", "'title' | 'big'", TextSearchType.NONE) + } +} +``` + @@ -494,6 +566,17 @@ final result = await client .textSearch('fts', "'little' & 'big'"); ``` + + + +```kotlin +val data = supabase.from("books").select { + filter { + textSearch("fts", "'title' & 'big'", TextSearchType.NONE) + } +} +``` + @@ -552,6 +635,17 @@ final result = await client .textSearch('description', "'big' <-> 'dreams'"); ``` + + + +```kotlin +val data = supabase.from("books").select { + filter { + textSearch("description", "'big' <-> 'dreams'", TextSearchType.NONE) + } +} +``` + @@ -595,6 +689,17 @@ final result = await client .textSearch('description', "'year' <2> 'school'"); ``` + + + +```kotlin +val data = supabase.from("books").select { + filter { + textSearch("description", "'year' <2> 'school'", TextSearchType.NONE) + } +} +``` + @@ -641,6 +746,17 @@ final result = await client .textSearch('description', "'big' & !'little'"); ``` + + + +```kotlin +val data = supabase.from("books").select { + filter { + textSearch("description", "'big' & !'little'", TextSearchType.NONE) + } +} +``` + diff --git a/apps/docs/pages/guides/database/functions.mdx b/apps/docs/pages/guides/database/functions.mdx index 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 supabase Reference: [rpc()](../../reference/dart/rpc) + + + +```kotlin +val data = supabase.postgrest.rpc("hello_world") +``` + +Reference: [rpc()](../../reference/kotlin/rpc) + @@ -209,6 +218,17 @@ final data = await supabase .eq('id', 1); ``` + + + +```kotlin +val data = supabase.postgrest.rpc("get_planets") { + filter { + eq("id", 1) + } +} +``` + @@ -263,6 +283,18 @@ final data = await supabase .rpc('add_planet', params: { 'name': 'Jakku' }); ``` + + + +```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") + } +) +``` + diff --git a/apps/docs/pages/guides/database/joins-and-nesting.mdx b/apps/docs/pages/guides/database/joins-and-nesting.mdx index 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 = data final data = await supabase.from('countries').select('id, name, cities(id, name)'); ``` + + + +```kotlin +val data = supabase.from("countries").select(Columns.raw("id, name, cities(id, name)")) +``` + @@ -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)'); ``` + + + +```kotlin +val data = supabase.from("teams").select(Columns.raw("id, team_name, users(id, name)")); +``` + diff --git a/apps/docs/pages/guides/database/json.mdx b/apps/docs/pages/guides/database/json.mdx index 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([ ]) ``` + + + +```kotlin +@Serializable +data class BookMetadata( + val description: String, + val price: Double, + val ages: List +) + +@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))) +)) +``` + @@ -220,6 +249,19 @@ const { data, error } = await supabase.from('books').select(` `) ``` + + + +```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())) +``` + diff --git a/apps/docs/pages/guides/database/tables.mdx b/apps/docs/pages/guides/database/tables.mdx index 9590fe48157..4fa2dc22b68 100644 --- a/apps/docs/pages/guides/database/tables.mdx +++ b/apps/docs/pages/guides/database/tables.mdx @@ -202,22 +202,25 @@ values -```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.', + }, +]) ``` -```sql +```dart await supabase .from('movies') .insert([{ @@ -229,6 +232,26 @@ await supabase }]); ``` + + + +```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."), + )) +``` + diff --git a/i18n/README.tr.md b/i18n/README.tr.md index 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 ![Supabase Dashboard](https://raw.githubusercontent.com/supabase/supabase/master/apps/www/public/images/github/supabase-dashboard.png)