-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add RecordApi.list examples to docs and streamline the list APIs for …
…rust and dotnet.
- Loading branch information
Showing
18 changed files
with
230 additions
and
76 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
16 changes: 16 additions & 0 deletions
16
client/testfixture/migrations/U1728810800__create_table_movies.sql
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,16 @@ | ||
-- A table schema to hold the IMDB test dataset from: | ||
-- https://www.kaggle.com/datasets/inductiveanks/top-1000-imdb-movies-dataset/data | ||
-- | ||
-- The only TrailBase API requirements are: "STRICT" typing and a INTEGER (or | ||
-- UUIDv7) PRIMARY KEY column. | ||
CREATE TABLE IF NOT EXISTS movies ( | ||
rank INTEGER PRIMARY KEY, | ||
name TEXT NOT NULL, | ||
year ANY NOT NULL, | ||
watch_time INTEGER NOT NULL, | ||
rating REAL NOT NULL, | ||
metascore ANY, | ||
gross ANY, | ||
votes TEXT NOT NULL, | ||
description TEXT NOT NULL | ||
) STRICT; |
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
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,5 @@ | ||
curl --globoff \ | ||
--header "Content-Type: application/json" \ | ||
--header "Authorization: Bearer ${AUTH_TOKEN}" \ | ||
--request GET \ | ||
'http://localhost:4000/api/records/v1/movies?limit=3&order=rank&watch_time[lt]=120&description[like]=%love%' |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export 'src/create.dart'; | ||
export 'src/read.dart'; | ||
export 'src/update.dart'; | ||
export 'src/delete.dart'; | ||
export 'src/list.dart'; | ||
export 'src/read.dart'; | ||
export 'src/subscribe.dart'; | ||
export 'src/update.dart'; |
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,8 @@ | ||
import 'package:trailbase/trailbase.dart'; | ||
|
||
Future<ListResponse> list(Client client) async => | ||
await client.records('movies').list( | ||
pagination: Pagination(limit: 3), | ||
order: ['rank'], | ||
filters: ['watch_time[lt]=120', 'description[like]=%love%'], | ||
); |
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,10 @@ | ||
using TrailBase; | ||
using System.Text.Json.Nodes; | ||
|
||
public partial class Examples { | ||
public static async Task<ListResponse<JsonObject>> List(Client client) => | ||
await client.Records("movies").List( | ||
pagination: new Pagination(limit: 3), | ||
order: ["rank"], | ||
filters: ["watch_time[lt]=120", "description[like]=%love%"]); | ||
} |
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,17 @@ | ||
use trailbase_client::{Client, ListResponse, Pagination}; | ||
|
||
pub async fn list(client: &Client) -> anyhow::Result<ListResponse<serde_json::Value>> { | ||
Ok( | ||
client | ||
.records("movies") | ||
.list( | ||
Pagination { | ||
limit: Some(3), | ||
..Default::default() | ||
}, | ||
&["rank"], | ||
&["watch_time[lt]=120", "description[like]=%love%"], | ||
) | ||
.await?, | ||
) | ||
} |
Oops, something went wrong.