Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ class PostgrestTypedTransformBuilder<Row, T> extends PostgrestTypedBuilder<T> {
/// This uses the `nulls=stripped` variant of the `Accept` header and
/// requires PostgREST 11.2 or higher.
PostgrestTypedTransformBuilder<Row, T> stripNulls() =>
PostgrestTypedTransformBuilder._(_transformBuilder.stripNulls(), _table);
PostgrestTypedTransformBuilder._(
_transformBuilder.stripNulls(),
_rowFromJson,
);

/// Runs the query but rolls back the transaction, so no changes are
/// persisted.
Expand All @@ -121,10 +124,13 @@ class PostgrestTypedTransformBuilder<Row, T> extends PostgrestTypedBuilder<T> {
/// which is useful for previewing the effect of a mutation.
///
/// ```dart
/// await client.table(Books.table).insert({'title': 'foo'}).dryRun();
/// await client.table(Books.table).insert(BookInsert(title: 'foo')).dryRun();
/// ```
PostgrestTypedTransformBuilder<Row, T> dryRun() =>
PostgrestTypedTransformBuilder._(_transformBuilder.dryRun(), _table);
PostgrestTypedTransformBuilder._(
_transformBuilder.dryRun(),
_rowFromJson,
);

/// Sets the maximum number of rows that can be affected by the query.
///
Expand All @@ -141,7 +147,7 @@ class PostgrestTypedTransformBuilder<Row, T> extends PostgrestTypedBuilder<T> {
PostgrestTypedTransformBuilder<Row, T> maxAffected(int value) =>
PostgrestTypedTransformBuilder._(
_transformBuilder.maxAffected(value),
_table,
_rowFromJson,
);

/// Retrieves the response as CSV.
Expand All @@ -152,7 +158,10 @@ class PostgrestTypedTransformBuilder<Row, T> extends PostgrestTypedBuilder<T> {
/// final String csv = await client.table(Books.table).select().csv();
/// ```
PostgrestTypedTransformBuilder<Row, String> csv() =>
PostgrestTypedTransformBuilder._(_transformBuilder.csv(), _table);
PostgrestTypedTransformBuilder._(
_transformBuilder.csv(),
_rowFromJson,
);

/// Performs a head request.
///
Expand Down
4 changes: 2 additions & 2 deletions packages/postgrest/test/typed_query_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ void main() {

final Book book = await client
.table(Books.table)
.insert({'title': 'foo'})
.insert(BookInsert(title: 'foo'))
.select()
.single()
.dryRun();
Expand Down Expand Up @@ -613,7 +613,7 @@ void main() {

final List<Book> books = await client
.table(Books.table)
.update({'title': 'bar'})
.update(BookUpdate(title: 'bar'))
.where(Books.id.eq(1))
.maxAffected(1)
.select();
Expand Down