mirror of https://github.com/AMT-Cheif/drift.git
Merge branch 'develop' of https://github.com/dickermoshe/drift into develop
This commit is contained in:
commit
b35056e16e
|
@ -0,0 +1,9 @@
|
|||
import '../setup/database.dart';
|
||||
|
||||
extension ManagerExamples on AppDatabase {
|
||||
// #docregion create
|
||||
Future<void> createTodoItem() async {
|
||||
await managers.todoItems.create((o) => o(title: '', content: ''));
|
||||
}
|
||||
// #enddocregion create
|
||||
}
|
|
@ -1,9 +1,11 @@
|
|||
// ignore_for_file: type=lint
|
||||
import 'package:drift/drift.dart' as i0;
|
||||
import 'package:drift_docs/snippets/_shared/todo_tables.drift.dart' as i1;
|
||||
import 'package:drift/internal/modular.dart' as i2;
|
||||
|
||||
abstract class $MyDatabase extends i0.GeneratedDatabase {
|
||||
$MyDatabase(i0.QueryExecutor e) : super(e);
|
||||
$MyDatabaseManager get managers => $MyDatabaseManager(this);
|
||||
late final i1.$CategoriesTable categories = i1.$CategoriesTable(this);
|
||||
late final i1.$TodoItemsTable todoItems = i1.$TodoItemsTable(this);
|
||||
i0.Selectable<CategoriesWithCountResult> categoriesWithCount() {
|
||||
|
@ -28,6 +30,226 @@ abstract class $MyDatabase extends i0.GeneratedDatabase {
|
|||
[categories, todoItems];
|
||||
}
|
||||
|
||||
class $$CategoriesTableFilterComposer
|
||||
extends i0.FilterComposer<i0.GeneratedDatabase, i1.$CategoriesTable> {
|
||||
$$CategoriesTableFilterComposer(super.db, super.table);
|
||||
i0.ColumnFilters<int> get id => i0.ColumnFilters($table.id);
|
||||
i0.ColumnFilters<String> get name => i0.ColumnFilters($table.name);
|
||||
i0.ComposableFilter todoItemsRefs(
|
||||
i0.ComposableFilter Function($$TodoItemsTableFilterComposer f) f) {
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: i2.ReadDatabaseContainer($db)
|
||||
.resultSet<i1.$TodoItemsTable>('todo_items'),
|
||||
getCurrentColumn: (f) => f.id,
|
||||
getReferencedColumn: (f) => f.category,
|
||||
getReferencedComposer: (db, table) =>
|
||||
$$TodoItemsTableFilterComposer(db, table),
|
||||
builder: f);
|
||||
}
|
||||
}
|
||||
|
||||
class $$CategoriesTableOrderingComposer
|
||||
extends i0.OrderingComposer<i0.GeneratedDatabase, i1.$CategoriesTable> {
|
||||
$$CategoriesTableOrderingComposer(super.db, super.table);
|
||||
i0.ColumnOrderings get id => i0.ColumnOrderings($table.id);
|
||||
i0.ColumnOrderings get name => i0.ColumnOrderings($table.name);
|
||||
}
|
||||
|
||||
class $$CategoriesTableProcessedTableManager extends i0.ProcessedTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i1.$CategoriesTable,
|
||||
i1.Category,
|
||||
$$CategoriesTableFilterComposer,
|
||||
$$CategoriesTableOrderingComposer,
|
||||
$$CategoriesTableProcessedTableManager,
|
||||
$$CategoriesTableInsertCompanionBuilder,
|
||||
$$CategoriesTableUpdateCompanionBuilder> {
|
||||
const $$CategoriesTableProcessedTableManager(super.$state);
|
||||
}
|
||||
|
||||
typedef $$CategoriesTableInsertCompanionBuilder = i1.CategoriesCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
required String name,
|
||||
});
|
||||
typedef $$CategoriesTableUpdateCompanionBuilder = i1.CategoriesCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
i0.Value<String> name,
|
||||
});
|
||||
|
||||
class $$CategoriesTableTableManager extends i0.RootTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i1.$CategoriesTable,
|
||||
i1.Category,
|
||||
$$CategoriesTableFilterComposer,
|
||||
$$CategoriesTableOrderingComposer,
|
||||
$$CategoriesTableProcessedTableManager,
|
||||
$$CategoriesTableInsertCompanionBuilder,
|
||||
$$CategoriesTableUpdateCompanionBuilder> {
|
||||
$$CategoriesTableTableManager(
|
||||
i0.GeneratedDatabase db, i1.$CategoriesTable table)
|
||||
: super(i0.TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
filteringComposer: $$CategoriesTableFilterComposer(db, table),
|
||||
orderingComposer: $$CategoriesTableOrderingComposer(db, table),
|
||||
getChildManagerBuilder: (p0) =>
|
||||
$$CategoriesTableProcessedTableManager(p0),
|
||||
getUpdateCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
i0.Value<String> name = const i0.Value.absent(),
|
||||
}) =>
|
||||
i1.CategoriesCompanion(
|
||||
id: id,
|
||||
name: name,
|
||||
),
|
||||
getInsertCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
required String name,
|
||||
}) =>
|
||||
i1.CategoriesCompanion.insert(
|
||||
id: id,
|
||||
name: name,
|
||||
)));
|
||||
}
|
||||
|
||||
class $$TodoItemsTableFilterComposer
|
||||
extends i0.FilterComposer<i0.GeneratedDatabase, i1.$TodoItemsTable> {
|
||||
$$TodoItemsTableFilterComposer(super.db, super.table);
|
||||
i0.ColumnFilters<int> get id => i0.ColumnFilters($table.id);
|
||||
i0.ColumnFilters<String> get title => i0.ColumnFilters($table.title);
|
||||
i0.ColumnFilters<String> get content => i0.ColumnFilters($table.content);
|
||||
i0.ColumnFilters<int> get categoryId => i0.ColumnFilters($table.category);
|
||||
i0.ComposableFilter category(
|
||||
i0.ComposableFilter Function($$CategoriesTableFilterComposer f) f) {
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: i2.ReadDatabaseContainer($db)
|
||||
.resultSet<i1.$CategoriesTable>('categories'),
|
||||
getCurrentColumn: (f) => f.category,
|
||||
getReferencedColumn: (f) => f.id,
|
||||
getReferencedComposer: (db, table) =>
|
||||
$$CategoriesTableFilterComposer(db, table),
|
||||
builder: f);
|
||||
}
|
||||
|
||||
i0.ColumnFilters<DateTime> get dueDate => i0.ColumnFilters($table.dueDate);
|
||||
}
|
||||
|
||||
class $$TodoItemsTableOrderingComposer
|
||||
extends i0.OrderingComposer<i0.GeneratedDatabase, i1.$TodoItemsTable> {
|
||||
$$TodoItemsTableOrderingComposer(super.db, super.table);
|
||||
i0.ColumnOrderings get id => i0.ColumnOrderings($table.id);
|
||||
i0.ColumnOrderings get title => i0.ColumnOrderings($table.title);
|
||||
i0.ColumnOrderings get content => i0.ColumnOrderings($table.content);
|
||||
i0.ColumnOrderings get categoryId => i0.ColumnOrderings($table.category);
|
||||
i0.ComposableOrdering category(
|
||||
i0.ComposableOrdering Function($$CategoriesTableOrderingComposer o) o) {
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: i2.ReadDatabaseContainer($db)
|
||||
.resultSet<i1.$CategoriesTable>('categories'),
|
||||
getCurrentColumn: (f) => f.category,
|
||||
getReferencedColumn: (f) => f.id,
|
||||
getReferencedComposer: (db, table) =>
|
||||
$$CategoriesTableOrderingComposer(db, table),
|
||||
builder: o);
|
||||
}
|
||||
|
||||
i0.ColumnOrderings get dueDate => i0.ColumnOrderings($table.dueDate);
|
||||
}
|
||||
|
||||
class $$TodoItemsTableProcessedTableManager extends i0.ProcessedTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i1.$TodoItemsTable,
|
||||
i1.TodoItem,
|
||||
$$TodoItemsTableFilterComposer,
|
||||
$$TodoItemsTableOrderingComposer,
|
||||
$$TodoItemsTableProcessedTableManager,
|
||||
$$TodoItemsTableInsertCompanionBuilder,
|
||||
$$TodoItemsTableUpdateCompanionBuilder> {
|
||||
const $$TodoItemsTableProcessedTableManager(super.$state);
|
||||
}
|
||||
|
||||
typedef $$TodoItemsTableInsertCompanionBuilder = i1.TodoItemsCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
required String title,
|
||||
required String content,
|
||||
i0.Value<int?> category,
|
||||
i0.Value<DateTime?> dueDate,
|
||||
});
|
||||
typedef $$TodoItemsTableUpdateCompanionBuilder = i1.TodoItemsCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
i0.Value<String> title,
|
||||
i0.Value<String> content,
|
||||
i0.Value<int?> category,
|
||||
i0.Value<DateTime?> dueDate,
|
||||
});
|
||||
|
||||
class $$TodoItemsTableTableManager extends i0.RootTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i1.$TodoItemsTable,
|
||||
i1.TodoItem,
|
||||
$$TodoItemsTableFilterComposer,
|
||||
$$TodoItemsTableOrderingComposer,
|
||||
$$TodoItemsTableProcessedTableManager,
|
||||
$$TodoItemsTableInsertCompanionBuilder,
|
||||
$$TodoItemsTableUpdateCompanionBuilder> {
|
||||
$$TodoItemsTableTableManager(
|
||||
i0.GeneratedDatabase db, i1.$TodoItemsTable table)
|
||||
: super(i0.TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
filteringComposer: $$TodoItemsTableFilterComposer(db, table),
|
||||
orderingComposer: $$TodoItemsTableOrderingComposer(db, table),
|
||||
getChildManagerBuilder: (p0) =>
|
||||
$$TodoItemsTableProcessedTableManager(p0),
|
||||
getUpdateCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
i0.Value<String> title = const i0.Value.absent(),
|
||||
i0.Value<String> content = const i0.Value.absent(),
|
||||
i0.Value<int?> category = const i0.Value.absent(),
|
||||
i0.Value<DateTime?> dueDate = const i0.Value.absent(),
|
||||
}) =>
|
||||
i1.TodoItemsCompanion(
|
||||
id: id,
|
||||
title: title,
|
||||
content: content,
|
||||
category: category,
|
||||
dueDate: dueDate,
|
||||
),
|
||||
getInsertCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
required String title,
|
||||
required String content,
|
||||
i0.Value<int?> category = const i0.Value.absent(),
|
||||
i0.Value<DateTime?> dueDate = const i0.Value.absent(),
|
||||
}) =>
|
||||
i1.TodoItemsCompanion.insert(
|
||||
id: id,
|
||||
title: title,
|
||||
content: content,
|
||||
category: category,
|
||||
dueDate: dueDate,
|
||||
)));
|
||||
}
|
||||
|
||||
class $MyDatabaseManager {
|
||||
final $MyDatabase _db;
|
||||
$MyDatabaseManager(this._db);
|
||||
$$CategoriesTableTableManager get categories =>
|
||||
$$CategoriesTableTableManager(_db, _db.categories);
|
||||
$$TodoItemsTableTableManager get todoItems =>
|
||||
$$TodoItemsTableTableManager(_db, _db.todoItems);
|
||||
}
|
||||
|
||||
class CategoriesWithCountResult {
|
||||
final int id;
|
||||
final String name;
|
||||
|
|
|
@ -7,6 +7,7 @@ import 'package:drift_docs/snippets/modular/many_to_many/json.dart' as i3;
|
|||
|
||||
abstract class $JsonBasedDatabase extends i0.GeneratedDatabase {
|
||||
$JsonBasedDatabase(i0.QueryExecutor e) : super(e);
|
||||
$JsonBasedDatabaseManager get managers => $JsonBasedDatabaseManager(this);
|
||||
late final i1.$BuyableItemsTable buyableItems = i1.$BuyableItemsTable(this);
|
||||
late final i2.$ShoppingCartsTable shoppingCarts =
|
||||
i2.$ShoppingCartsTable(this);
|
||||
|
@ -18,6 +19,176 @@ abstract class $JsonBasedDatabase extends i0.GeneratedDatabase {
|
|||
[buyableItems, shoppingCarts];
|
||||
}
|
||||
|
||||
class $$BuyableItemsTableFilterComposer
|
||||
extends i0.FilterComposer<i0.GeneratedDatabase, i1.$BuyableItemsTable> {
|
||||
$$BuyableItemsTableFilterComposer(super.db, super.table);
|
||||
i0.ColumnFilters<int> get id => i0.ColumnFilters($table.id);
|
||||
i0.ColumnFilters<String> get description =>
|
||||
i0.ColumnFilters($table.description);
|
||||
i0.ColumnFilters<int> get price => i0.ColumnFilters($table.price);
|
||||
}
|
||||
|
||||
class $$BuyableItemsTableOrderingComposer
|
||||
extends i0.OrderingComposer<i0.GeneratedDatabase, i1.$BuyableItemsTable> {
|
||||
$$BuyableItemsTableOrderingComposer(super.db, super.table);
|
||||
i0.ColumnOrderings get id => i0.ColumnOrderings($table.id);
|
||||
i0.ColumnOrderings get description => i0.ColumnOrderings($table.description);
|
||||
i0.ColumnOrderings get price => i0.ColumnOrderings($table.price);
|
||||
}
|
||||
|
||||
class $$BuyableItemsTableProcessedTableManager extends i0.ProcessedTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i1.$BuyableItemsTable,
|
||||
i1.BuyableItem,
|
||||
$$BuyableItemsTableFilterComposer,
|
||||
$$BuyableItemsTableOrderingComposer,
|
||||
$$BuyableItemsTableProcessedTableManager,
|
||||
$$BuyableItemsTableInsertCompanionBuilder,
|
||||
$$BuyableItemsTableUpdateCompanionBuilder> {
|
||||
const $$BuyableItemsTableProcessedTableManager(super.$state);
|
||||
}
|
||||
|
||||
typedef $$BuyableItemsTableInsertCompanionBuilder = i1.BuyableItemsCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
required String description,
|
||||
required int price,
|
||||
});
|
||||
typedef $$BuyableItemsTableUpdateCompanionBuilder = i1.BuyableItemsCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
i0.Value<String> description,
|
||||
i0.Value<int> price,
|
||||
});
|
||||
|
||||
class $$BuyableItemsTableTableManager extends i0.RootTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i1.$BuyableItemsTable,
|
||||
i1.BuyableItem,
|
||||
$$BuyableItemsTableFilterComposer,
|
||||
$$BuyableItemsTableOrderingComposer,
|
||||
$$BuyableItemsTableProcessedTableManager,
|
||||
$$BuyableItemsTableInsertCompanionBuilder,
|
||||
$$BuyableItemsTableUpdateCompanionBuilder> {
|
||||
$$BuyableItemsTableTableManager(
|
||||
i0.GeneratedDatabase db, i1.$BuyableItemsTable table)
|
||||
: super(i0.TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
filteringComposer: $$BuyableItemsTableFilterComposer(db, table),
|
||||
orderingComposer: $$BuyableItemsTableOrderingComposer(db, table),
|
||||
getChildManagerBuilder: (p0) =>
|
||||
$$BuyableItemsTableProcessedTableManager(p0),
|
||||
getUpdateCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
i0.Value<String> description = const i0.Value.absent(),
|
||||
i0.Value<int> price = const i0.Value.absent(),
|
||||
}) =>
|
||||
i1.BuyableItemsCompanion(
|
||||
id: id,
|
||||
description: description,
|
||||
price: price,
|
||||
),
|
||||
getInsertCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
required String description,
|
||||
required int price,
|
||||
}) =>
|
||||
i1.BuyableItemsCompanion.insert(
|
||||
id: id,
|
||||
description: description,
|
||||
price: price,
|
||||
)));
|
||||
}
|
||||
|
||||
class $$ShoppingCartsTableFilterComposer
|
||||
extends i0.FilterComposer<i0.GeneratedDatabase, i2.$ShoppingCartsTable> {
|
||||
$$ShoppingCartsTableFilterComposer(super.db, super.table);
|
||||
i0.ColumnFilters<int> get id => i0.ColumnFilters($table.id);
|
||||
i0.ColumnFilters<String> get entriesValue => i0.ColumnFilters($table.entries);
|
||||
i0.ColumnWithTypeConverterFilters<
|
||||
i3.ShoppingCartEntries,
|
||||
i3.ShoppingCartEntries,
|
||||
String> get entries => i0.ColumnWithTypeConverterFilters($table.entries);
|
||||
}
|
||||
|
||||
class $$ShoppingCartsTableOrderingComposer
|
||||
extends i0.OrderingComposer<i0.GeneratedDatabase, i2.$ShoppingCartsTable> {
|
||||
$$ShoppingCartsTableOrderingComposer(super.db, super.table);
|
||||
i0.ColumnOrderings get id => i0.ColumnOrderings($table.id);
|
||||
i0.ColumnOrderings get entries => i0.ColumnOrderings($table.entries);
|
||||
}
|
||||
|
||||
class $$ShoppingCartsTableProcessedTableManager
|
||||
extends i0.ProcessedTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i2.$ShoppingCartsTable,
|
||||
i2.ShoppingCart,
|
||||
$$ShoppingCartsTableFilterComposer,
|
||||
$$ShoppingCartsTableOrderingComposer,
|
||||
$$ShoppingCartsTableProcessedTableManager,
|
||||
$$ShoppingCartsTableInsertCompanionBuilder,
|
||||
$$ShoppingCartsTableUpdateCompanionBuilder> {
|
||||
const $$ShoppingCartsTableProcessedTableManager(super.$state);
|
||||
}
|
||||
|
||||
typedef $$ShoppingCartsTableInsertCompanionBuilder = i2.ShoppingCartsCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
required i3.ShoppingCartEntries entries,
|
||||
});
|
||||
typedef $$ShoppingCartsTableUpdateCompanionBuilder = i2.ShoppingCartsCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
i0.Value<i3.ShoppingCartEntries> entries,
|
||||
});
|
||||
|
||||
class $$ShoppingCartsTableTableManager extends i0.RootTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i2.$ShoppingCartsTable,
|
||||
i2.ShoppingCart,
|
||||
$$ShoppingCartsTableFilterComposer,
|
||||
$$ShoppingCartsTableOrderingComposer,
|
||||
$$ShoppingCartsTableProcessedTableManager,
|
||||
$$ShoppingCartsTableInsertCompanionBuilder,
|
||||
$$ShoppingCartsTableUpdateCompanionBuilder> {
|
||||
$$ShoppingCartsTableTableManager(
|
||||
i0.GeneratedDatabase db, i2.$ShoppingCartsTable table)
|
||||
: super(i0.TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
filteringComposer: $$ShoppingCartsTableFilterComposer(db, table),
|
||||
orderingComposer: $$ShoppingCartsTableOrderingComposer(db, table),
|
||||
getChildManagerBuilder: (p0) =>
|
||||
$$ShoppingCartsTableProcessedTableManager(p0),
|
||||
getUpdateCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
i0.Value<i3.ShoppingCartEntries> entries =
|
||||
const i0.Value.absent(),
|
||||
}) =>
|
||||
i2.ShoppingCartsCompanion(
|
||||
id: id,
|
||||
entries: entries,
|
||||
),
|
||||
getInsertCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
required i3.ShoppingCartEntries entries,
|
||||
}) =>
|
||||
i2.ShoppingCartsCompanion.insert(
|
||||
id: id,
|
||||
entries: entries,
|
||||
)));
|
||||
}
|
||||
|
||||
class $JsonBasedDatabaseManager {
|
||||
final $JsonBasedDatabase _db;
|
||||
$JsonBasedDatabaseManager(this._db);
|
||||
$$BuyableItemsTableTableManager get buyableItems =>
|
||||
$$BuyableItemsTableTableManager(_db, _db.buyableItems);
|
||||
$$ShoppingCartsTableTableManager get shoppingCarts =>
|
||||
$$ShoppingCartsTableTableManager(_db, _db.shoppingCarts);
|
||||
}
|
||||
|
||||
class $ShoppingCartsTable extends i3.ShoppingCarts
|
||||
with i0.TableInfo<$ShoppingCartsTable, i2.ShoppingCart> {
|
||||
@override
|
||||
|
|
|
@ -4,10 +4,12 @@ import 'package:drift_docs/snippets/modular/many_to_many/shared.drift.dart'
|
|||
as i1;
|
||||
import 'package:drift_docs/snippets/modular/many_to_many/relational.drift.dart'
|
||||
as i2;
|
||||
import 'package:drift_docs/snippets/modular/many_to_many/relational.dart' as i3;
|
||||
import 'package:drift/internal/modular.dart' as i3;
|
||||
import 'package:drift_docs/snippets/modular/many_to_many/relational.dart' as i4;
|
||||
|
||||
abstract class $RelationalDatabase extends i0.GeneratedDatabase {
|
||||
$RelationalDatabase(i0.QueryExecutor e) : super(e);
|
||||
$RelationalDatabaseManager get managers => $RelationalDatabaseManager(this);
|
||||
late final i1.$BuyableItemsTable buyableItems = i1.$BuyableItemsTable(this);
|
||||
late final i2.$ShoppingCartsTable shoppingCarts =
|
||||
i2.$ShoppingCartsTable(this);
|
||||
|
@ -21,7 +23,333 @@ abstract class $RelationalDatabase extends i0.GeneratedDatabase {
|
|||
[buyableItems, shoppingCarts, shoppingCartEntries];
|
||||
}
|
||||
|
||||
class $ShoppingCartsTable extends i3.ShoppingCarts
|
||||
class $$BuyableItemsTableFilterComposer
|
||||
extends i0.FilterComposer<i0.GeneratedDatabase, i1.$BuyableItemsTable> {
|
||||
$$BuyableItemsTableFilterComposer(super.db, super.table);
|
||||
i0.ColumnFilters<int> get id => i0.ColumnFilters($table.id);
|
||||
i0.ColumnFilters<String> get description =>
|
||||
i0.ColumnFilters($table.description);
|
||||
i0.ColumnFilters<int> get price => i0.ColumnFilters($table.price);
|
||||
i0.ComposableFilter shoppingCartEntriesRefs(
|
||||
i0.ComposableFilter Function($$ShoppingCartEntriesTableFilterComposer f)
|
||||
f) {
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: i3.ReadDatabaseContainer($db)
|
||||
.resultSet<i2.$ShoppingCartEntriesTable>('shopping_cart_entries'),
|
||||
getCurrentColumn: (f) => f.id,
|
||||
getReferencedColumn: (f) => f.item,
|
||||
getReferencedComposer: (db, table) =>
|
||||
$$ShoppingCartEntriesTableFilterComposer(db, table),
|
||||
builder: f);
|
||||
}
|
||||
}
|
||||
|
||||
class $$BuyableItemsTableOrderingComposer
|
||||
extends i0.OrderingComposer<i0.GeneratedDatabase, i1.$BuyableItemsTable> {
|
||||
$$BuyableItemsTableOrderingComposer(super.db, super.table);
|
||||
i0.ColumnOrderings get id => i0.ColumnOrderings($table.id);
|
||||
i0.ColumnOrderings get description => i0.ColumnOrderings($table.description);
|
||||
i0.ColumnOrderings get price => i0.ColumnOrderings($table.price);
|
||||
}
|
||||
|
||||
class $$BuyableItemsTableProcessedTableManager extends i0.ProcessedTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i1.$BuyableItemsTable,
|
||||
i1.BuyableItem,
|
||||
$$BuyableItemsTableFilterComposer,
|
||||
$$BuyableItemsTableOrderingComposer,
|
||||
$$BuyableItemsTableProcessedTableManager,
|
||||
$$BuyableItemsTableInsertCompanionBuilder,
|
||||
$$BuyableItemsTableUpdateCompanionBuilder> {
|
||||
const $$BuyableItemsTableProcessedTableManager(super.$state);
|
||||
}
|
||||
|
||||
typedef $$BuyableItemsTableInsertCompanionBuilder = i1.BuyableItemsCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
required String description,
|
||||
required int price,
|
||||
});
|
||||
typedef $$BuyableItemsTableUpdateCompanionBuilder = i1.BuyableItemsCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
i0.Value<String> description,
|
||||
i0.Value<int> price,
|
||||
});
|
||||
|
||||
class $$BuyableItemsTableTableManager extends i0.RootTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i1.$BuyableItemsTable,
|
||||
i1.BuyableItem,
|
||||
$$BuyableItemsTableFilterComposer,
|
||||
$$BuyableItemsTableOrderingComposer,
|
||||
$$BuyableItemsTableProcessedTableManager,
|
||||
$$BuyableItemsTableInsertCompanionBuilder,
|
||||
$$BuyableItemsTableUpdateCompanionBuilder> {
|
||||
$$BuyableItemsTableTableManager(
|
||||
i0.GeneratedDatabase db, i1.$BuyableItemsTable table)
|
||||
: super(i0.TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
filteringComposer: $$BuyableItemsTableFilterComposer(db, table),
|
||||
orderingComposer: $$BuyableItemsTableOrderingComposer(db, table),
|
||||
getChildManagerBuilder: (p0) =>
|
||||
$$BuyableItemsTableProcessedTableManager(p0),
|
||||
getUpdateCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
i0.Value<String> description = const i0.Value.absent(),
|
||||
i0.Value<int> price = const i0.Value.absent(),
|
||||
}) =>
|
||||
i1.BuyableItemsCompanion(
|
||||
id: id,
|
||||
description: description,
|
||||
price: price,
|
||||
),
|
||||
getInsertCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
required String description,
|
||||
required int price,
|
||||
}) =>
|
||||
i1.BuyableItemsCompanion.insert(
|
||||
id: id,
|
||||
description: description,
|
||||
price: price,
|
||||
)));
|
||||
}
|
||||
|
||||
class $$ShoppingCartsTableFilterComposer
|
||||
extends i0.FilterComposer<i0.GeneratedDatabase, i2.$ShoppingCartsTable> {
|
||||
$$ShoppingCartsTableFilterComposer(super.db, super.table);
|
||||
i0.ColumnFilters<int> get id => i0.ColumnFilters($table.id);
|
||||
i0.ComposableFilter shoppingCartEntriesRefs(
|
||||
i0.ComposableFilter Function($$ShoppingCartEntriesTableFilterComposer f)
|
||||
f) {
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: i3.ReadDatabaseContainer($db)
|
||||
.resultSet<i2.$ShoppingCartEntriesTable>('shopping_cart_entries'),
|
||||
getCurrentColumn: (f) => f.id,
|
||||
getReferencedColumn: (f) => f.shoppingCart,
|
||||
getReferencedComposer: (db, table) =>
|
||||
$$ShoppingCartEntriesTableFilterComposer(db, table),
|
||||
builder: f);
|
||||
}
|
||||
}
|
||||
|
||||
class $$ShoppingCartsTableOrderingComposer
|
||||
extends i0.OrderingComposer<i0.GeneratedDatabase, i2.$ShoppingCartsTable> {
|
||||
$$ShoppingCartsTableOrderingComposer(super.db, super.table);
|
||||
i0.ColumnOrderings get id => i0.ColumnOrderings($table.id);
|
||||
}
|
||||
|
||||
class $$ShoppingCartsTableProcessedTableManager
|
||||
extends i0.ProcessedTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i2.$ShoppingCartsTable,
|
||||
i2.ShoppingCart,
|
||||
$$ShoppingCartsTableFilterComposer,
|
||||
$$ShoppingCartsTableOrderingComposer,
|
||||
$$ShoppingCartsTableProcessedTableManager,
|
||||
$$ShoppingCartsTableInsertCompanionBuilder,
|
||||
$$ShoppingCartsTableUpdateCompanionBuilder> {
|
||||
const $$ShoppingCartsTableProcessedTableManager(super.$state);
|
||||
}
|
||||
|
||||
typedef $$ShoppingCartsTableInsertCompanionBuilder = i2.ShoppingCartsCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
});
|
||||
typedef $$ShoppingCartsTableUpdateCompanionBuilder = i2.ShoppingCartsCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
});
|
||||
|
||||
class $$ShoppingCartsTableTableManager extends i0.RootTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i2.$ShoppingCartsTable,
|
||||
i2.ShoppingCart,
|
||||
$$ShoppingCartsTableFilterComposer,
|
||||
$$ShoppingCartsTableOrderingComposer,
|
||||
$$ShoppingCartsTableProcessedTableManager,
|
||||
$$ShoppingCartsTableInsertCompanionBuilder,
|
||||
$$ShoppingCartsTableUpdateCompanionBuilder> {
|
||||
$$ShoppingCartsTableTableManager(
|
||||
i0.GeneratedDatabase db, i2.$ShoppingCartsTable table)
|
||||
: super(i0.TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
filteringComposer: $$ShoppingCartsTableFilterComposer(db, table),
|
||||
orderingComposer: $$ShoppingCartsTableOrderingComposer(db, table),
|
||||
getChildManagerBuilder: (p0) =>
|
||||
$$ShoppingCartsTableProcessedTableManager(p0),
|
||||
getUpdateCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
}) =>
|
||||
i2.ShoppingCartsCompanion(
|
||||
id: id,
|
||||
),
|
||||
getInsertCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
}) =>
|
||||
i2.ShoppingCartsCompanion.insert(
|
||||
id: id,
|
||||
)));
|
||||
}
|
||||
|
||||
class $$ShoppingCartEntriesTableFilterComposer extends i0
|
||||
.FilterComposer<i0.GeneratedDatabase, i2.$ShoppingCartEntriesTable> {
|
||||
$$ShoppingCartEntriesTableFilterComposer(super.db, super.table);
|
||||
i0.ColumnFilters<int> get shoppingCartId =>
|
||||
i0.ColumnFilters($table.shoppingCart);
|
||||
i0.ComposableFilter shoppingCart(
|
||||
i0.ComposableFilter Function($$ShoppingCartsTableFilterComposer f) f) {
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: i3.ReadDatabaseContainer($db)
|
||||
.resultSet<i2.$ShoppingCartsTable>('shopping_carts'),
|
||||
getCurrentColumn: (f) => f.shoppingCart,
|
||||
getReferencedColumn: (f) => f.id,
|
||||
getReferencedComposer: (db, table) =>
|
||||
$$ShoppingCartsTableFilterComposer(db, table),
|
||||
builder: f);
|
||||
}
|
||||
|
||||
i0.ColumnFilters<int> get itemId => i0.ColumnFilters($table.item);
|
||||
i0.ComposableFilter item(
|
||||
i0.ComposableFilter Function($$BuyableItemsTableFilterComposer f) f) {
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: i3.ReadDatabaseContainer($db)
|
||||
.resultSet<i1.$BuyableItemsTable>('buyable_items'),
|
||||
getCurrentColumn: (f) => f.item,
|
||||
getReferencedColumn: (f) => f.id,
|
||||
getReferencedComposer: (db, table) =>
|
||||
$$BuyableItemsTableFilterComposer(db, table),
|
||||
builder: f);
|
||||
}
|
||||
}
|
||||
|
||||
class $$ShoppingCartEntriesTableOrderingComposer extends i0
|
||||
.OrderingComposer<i0.GeneratedDatabase, i2.$ShoppingCartEntriesTable> {
|
||||
$$ShoppingCartEntriesTableOrderingComposer(super.db, super.table);
|
||||
i0.ColumnOrderings get shoppingCartId =>
|
||||
i0.ColumnOrderings($table.shoppingCart);
|
||||
i0.ComposableOrdering shoppingCart(
|
||||
i0.ComposableOrdering Function($$ShoppingCartsTableOrderingComposer o)
|
||||
o) {
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: i3.ReadDatabaseContainer($db)
|
||||
.resultSet<i2.$ShoppingCartsTable>('shopping_carts'),
|
||||
getCurrentColumn: (f) => f.shoppingCart,
|
||||
getReferencedColumn: (f) => f.id,
|
||||
getReferencedComposer: (db, table) =>
|
||||
$$ShoppingCartsTableOrderingComposer(db, table),
|
||||
builder: o);
|
||||
}
|
||||
|
||||
i0.ColumnOrderings get itemId => i0.ColumnOrderings($table.item);
|
||||
i0.ComposableOrdering item(
|
||||
i0.ComposableOrdering Function($$BuyableItemsTableOrderingComposer o) o) {
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: i3.ReadDatabaseContainer($db)
|
||||
.resultSet<i1.$BuyableItemsTable>('buyable_items'),
|
||||
getCurrentColumn: (f) => f.item,
|
||||
getReferencedColumn: (f) => f.id,
|
||||
getReferencedComposer: (db, table) =>
|
||||
$$BuyableItemsTableOrderingComposer(db, table),
|
||||
builder: o);
|
||||
}
|
||||
}
|
||||
|
||||
class $$ShoppingCartEntriesTableProcessedTableManager
|
||||
extends i0.ProcessedTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i2.$ShoppingCartEntriesTable,
|
||||
i2.ShoppingCartEntry,
|
||||
$$ShoppingCartEntriesTableFilterComposer,
|
||||
$$ShoppingCartEntriesTableOrderingComposer,
|
||||
$$ShoppingCartEntriesTableProcessedTableManager,
|
||||
$$ShoppingCartEntriesTableInsertCompanionBuilder,
|
||||
$$ShoppingCartEntriesTableUpdateCompanionBuilder> {
|
||||
const $$ShoppingCartEntriesTableProcessedTableManager(super.$state);
|
||||
}
|
||||
|
||||
typedef $$ShoppingCartEntriesTableInsertCompanionBuilder
|
||||
= i2.ShoppingCartEntriesCompanion Function({
|
||||
required int shoppingCart,
|
||||
required int item,
|
||||
i0.Value<int> rowid,
|
||||
});
|
||||
typedef $$ShoppingCartEntriesTableUpdateCompanionBuilder
|
||||
= i2.ShoppingCartEntriesCompanion Function({
|
||||
i0.Value<int> shoppingCart,
|
||||
i0.Value<int> item,
|
||||
i0.Value<int> rowid,
|
||||
});
|
||||
|
||||
class $$ShoppingCartEntriesTableTableManager extends i0.RootTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i2.$ShoppingCartEntriesTable,
|
||||
i2.ShoppingCartEntry,
|
||||
$$ShoppingCartEntriesTableFilterComposer,
|
||||
$$ShoppingCartEntriesTableOrderingComposer,
|
||||
$$ShoppingCartEntriesTableProcessedTableManager,
|
||||
$$ShoppingCartEntriesTableInsertCompanionBuilder,
|
||||
$$ShoppingCartEntriesTableUpdateCompanionBuilder> {
|
||||
$$ShoppingCartEntriesTableTableManager(
|
||||
i0.GeneratedDatabase db, i2.$ShoppingCartEntriesTable table)
|
||||
: super(i0.TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
filteringComposer:
|
||||
$$ShoppingCartEntriesTableFilterComposer(db, table),
|
||||
orderingComposer:
|
||||
$$ShoppingCartEntriesTableOrderingComposer(db, table),
|
||||
getChildManagerBuilder: (p0) =>
|
||||
$$ShoppingCartEntriesTableProcessedTableManager(p0),
|
||||
getUpdateCompanionBuilder: ({
|
||||
i0.Value<int> shoppingCart = const i0.Value.absent(),
|
||||
i0.Value<int> item = const i0.Value.absent(),
|
||||
i0.Value<int> rowid = const i0.Value.absent(),
|
||||
}) =>
|
||||
i2.ShoppingCartEntriesCompanion(
|
||||
shoppingCart: shoppingCart,
|
||||
item: item,
|
||||
rowid: rowid,
|
||||
),
|
||||
getInsertCompanionBuilder: ({
|
||||
required int shoppingCart,
|
||||
required int item,
|
||||
i0.Value<int> rowid = const i0.Value.absent(),
|
||||
}) =>
|
||||
i2.ShoppingCartEntriesCompanion.insert(
|
||||
shoppingCart: shoppingCart,
|
||||
item: item,
|
||||
rowid: rowid,
|
||||
)));
|
||||
}
|
||||
|
||||
class $RelationalDatabaseManager {
|
||||
final $RelationalDatabase _db;
|
||||
$RelationalDatabaseManager(this._db);
|
||||
$$BuyableItemsTableTableManager get buyableItems =>
|
||||
$$BuyableItemsTableTableManager(_db, _db.buyableItems);
|
||||
$$ShoppingCartsTableTableManager get shoppingCarts =>
|
||||
$$ShoppingCartsTableTableManager(_db, _db.shoppingCarts);
|
||||
$$ShoppingCartEntriesTableTableManager get shoppingCartEntries =>
|
||||
$$ShoppingCartEntriesTableTableManager(_db, _db.shoppingCartEntries);
|
||||
}
|
||||
|
||||
class $ShoppingCartsTable extends i4.ShoppingCarts
|
||||
with i0.TableInfo<$ShoppingCartsTable, i2.ShoppingCart> {
|
||||
@override
|
||||
final i0.GeneratedDatabase attachedDatabase;
|
||||
|
@ -163,7 +491,7 @@ class ShoppingCartsCompanion extends i0.UpdateCompanion<i2.ShoppingCart> {
|
|||
}
|
||||
}
|
||||
|
||||
class $ShoppingCartEntriesTable extends i3.ShoppingCartEntries
|
||||
class $ShoppingCartEntriesTable extends i4.ShoppingCartEntries
|
||||
with i0.TableInfo<$ShoppingCartEntriesTable, i2.ShoppingCartEntry> {
|
||||
@override
|
||||
final i0.GeneratedDatabase attachedDatabase;
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
---
|
||||
data:
|
||||
title: Manager
|
||||
description: Use easier bindings for common queries.
|
||||
weight: 1
|
||||
|
||||
template: layouts/docs/single
|
||||
---
|
||||
|
||||
{% assign snippets = 'package:drift_docs/snippets/dart_api/manager.dart.excerpt.json' | readString | json_decode %}
|
||||
|
||||
With generated code, drift allows writing SQL queries in typesafe Dart.
|
||||
While this is provides lots of flexibility, it requires familiarity with SQL.
|
||||
As a simpler alternative, drift 2.17 introduced a new set of APIs designed to
|
||||
make common queries much easier to write.
|
||||
|
||||
The examples on this page use the database from the [setup]({{ '../setup.md' | pageUrl }})
|
||||
instructions.
|
||||
|
||||
## Select
|
||||
|
||||
### Count and exists
|
||||
|
||||
### Filtering across tables
|
||||
|
||||
## Updates
|
||||
|
||||
## Creating rows
|
||||
|
||||
{% include "blocks/snippet" snippets = snippets name = 'create' %}
|
||||
|
||||
## Deleting rows
|
||||
|
Loading…
Reference in New Issue