mirror of https://github.com/AMT-Cheif/drift.git
Update to lints 3.0.0
This commit is contained in:
parent
0a457e92e5
commit
220c7125a3
|
@ -29,7 +29,7 @@ class MyDatabase extends $MyDatabase {
|
||||||
@override
|
@override
|
||||||
int get schemaVersion => 1;
|
int get schemaVersion => 1;
|
||||||
|
|
||||||
MyDatabase(QueryExecutor e) : super(e);
|
MyDatabase(super.e);
|
||||||
|
|
||||||
// #docregion amountOfTodosInCategory
|
// #docregion amountOfTodosInCategory
|
||||||
Stream<int> amountOfTodosInCategory(int id) {
|
Stream<int> amountOfTodosInCategory(int id) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Todos extends Table {
|
||||||
|
|
||||||
@DriftDatabase(tables: [Todos])
|
@DriftDatabase(tables: [Todos])
|
||||||
class MyDatabase extends _$MyDatabase {
|
class MyDatabase extends _$MyDatabase {
|
||||||
MyDatabase(QueryExecutor e) : super(e);
|
MyDatabase(super.e);
|
||||||
|
|
||||||
// #docregion start
|
// #docregion start
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -8,14 +8,14 @@ import 'package:drift_dev/api/migrations.dart';
|
||||||
const kDebugMode = true;
|
const kDebugMode = true;
|
||||||
|
|
||||||
abstract class _$MyDatabase extends GeneratedDatabase {
|
abstract class _$MyDatabase extends GeneratedDatabase {
|
||||||
_$MyDatabase(QueryExecutor executor) : super(executor);
|
_$MyDatabase(super.executor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// #docregion
|
// #docregion
|
||||||
|
|
||||||
class MyDatabase extends _$MyDatabase {
|
class MyDatabase extends _$MyDatabase {
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
MyDatabase(QueryExecutor executor) : super(executor);
|
MyDatabase(super.executor);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Iterable<TableInfo<Table, dynamic>> get allTables =>
|
Iterable<TableInfo<Table, dynamic>> get allTables =>
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import 'package:drift/drift.dart';
|
|
||||||
|
|
||||||
import 'example.drift.dart';
|
import 'example.drift.dart';
|
||||||
|
|
||||||
class DartExample extends ExampleDrift {
|
class DartExample extends ExampleDrift {
|
||||||
DartExample(GeneratedDatabase attachedDatabase) : super(attachedDatabase);
|
DartExample(super.attachedDatabase);
|
||||||
|
|
||||||
// #docregion watchInCategory
|
// #docregion watchInCategory
|
||||||
Stream<List<Todo>> watchInCategory(int category) {
|
Stream<List<Todo>> watchInCategory(int category) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ class ShoppingCartEntries {
|
||||||
|
|
||||||
@DriftDatabase(tables: [BuyableItems, ShoppingCarts])
|
@DriftDatabase(tables: [BuyableItems, ShoppingCarts])
|
||||||
class JsonBasedDatabase extends $JsonBasedDatabase {
|
class JsonBasedDatabase extends $JsonBasedDatabase {
|
||||||
JsonBasedDatabase(QueryExecutor e) : super(e);
|
JsonBasedDatabase(super.e);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get schemaVersion => 1;
|
int get schemaVersion => 1;
|
||||||
|
|
|
@ -31,7 +31,7 @@ class ShoppingCartEntries extends Table {
|
||||||
|
|
||||||
@DriftDatabase(tables: [BuyableItems, ShoppingCarts, ShoppingCartEntries])
|
@DriftDatabase(tables: [BuyableItems, ShoppingCarts, ShoppingCartEntries])
|
||||||
class RelationalDatabase extends $RelationalDatabase {
|
class RelationalDatabase extends $RelationalDatabase {
|
||||||
RelationalDatabase(QueryExecutor e) : super(e);
|
RelationalDatabase(super.e);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get schemaVersion => 1;
|
int get schemaVersion => 1;
|
||||||
|
|
|
@ -28,7 +28,7 @@ DatabaseConnection connectOnWeb() {
|
||||||
|
|
||||||
// You can then use this method to open your database:
|
// You can then use this method to open your database:
|
||||||
class MyWebDatabase extends _$MyWebDatabase {
|
class MyWebDatabase extends _$MyWebDatabase {
|
||||||
MyWebDatabase._(QueryExecutor e) : super(e);
|
MyWebDatabase._(super.e);
|
||||||
|
|
||||||
factory MyWebDatabase() => MyWebDatabase._(connectOnWeb());
|
factory MyWebDatabase() => MyWebDatabase._(connectOnWeb());
|
||||||
// ...
|
// ...
|
||||||
|
|
|
@ -36,7 +36,7 @@ dependencies:
|
||||||
postgres: ^3.0.0-0
|
postgres: ^3.0.0-0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
lints: ^2.0.0
|
lints: ^3.0.0
|
||||||
build: ^2.1.0
|
build: ^2.1.0
|
||||||
build_runner: ^2.0.5
|
build_runner: ^2.0.5
|
||||||
build_runner_core: ^7.2.7
|
build_runner_core: ^7.2.7
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Users extends Table {
|
||||||
|
|
||||||
@DriftDatabase(tables: [Users])
|
@DriftDatabase(tables: [Users])
|
||||||
class Database extends _$Database {
|
class Database extends _$Database {
|
||||||
Database(QueryExecutor c) : super(c);
|
Database(super.c);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get schemaVersion => 1;
|
int get schemaVersion => 1;
|
||||||
|
|
|
@ -35,7 +35,7 @@ class SnippetsBuilder extends CodeExcerptBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _DriftHighlighter extends Highlighter {
|
class _DriftHighlighter extends Highlighter {
|
||||||
_DriftHighlighter(SourceFile file) : super(file);
|
_DriftHighlighter(super.file);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void highlight() {
|
void highlight() {
|
||||||
|
|
|
@ -64,7 +64,7 @@ abstract class TodoItemWithCategoryNameView extends View {
|
||||||
TodoItemWithCategoryNameView,
|
TodoItemWithCategoryNameView,
|
||||||
])
|
])
|
||||||
class Database extends _$Database {
|
class Database extends _$Database {
|
||||||
Database(QueryExecutor e) : super(e);
|
Database(super.e);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get schemaVersion => 2;
|
int get schemaVersion => 2;
|
||||||
|
|
|
@ -223,9 +223,9 @@ class VersionedVirtualTable extends VersionedTable
|
||||||
/// Create a virtual table by copying fields from [source] and applying a
|
/// Create a virtual table by copying fields from [source] and applying a
|
||||||
/// [alias] to columns.
|
/// [alias] to columns.
|
||||||
VersionedVirtualTable.aliased(
|
VersionedVirtualTable.aliased(
|
||||||
{required VersionedVirtualTable source, required String? alias})
|
{required VersionedVirtualTable super.source, required super.alias})
|
||||||
: moduleAndArgs = source.moduleAndArgs,
|
: moduleAndArgs = source.moduleAndArgs,
|
||||||
super.aliased(source: source, alias: alias);
|
super.aliased();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
VersionedVirtualTable createAlias(String alias) {
|
VersionedVirtualTable createAlias(String alias) {
|
||||||
|
|
|
@ -48,8 +48,8 @@ class NativeDatabase extends DelegatedDatabase {
|
||||||
// when changing this, also update the documentation in `drift_vm_database_factory`.
|
// when changing this, also update the documentation in `drift_vm_database_factory`.
|
||||||
static const _cacheStatementsByDefault = false;
|
static const _cacheStatementsByDefault = false;
|
||||||
|
|
||||||
NativeDatabase._(DatabaseDelegate delegate, bool logStatements)
|
NativeDatabase._(super.delegate, bool logStatements)
|
||||||
: super(delegate, isSequential: false, logStatements: logStatements);
|
: super(isSequential: false, logStatements: logStatements);
|
||||||
|
|
||||||
/// Creates a database that will store its result in the [file], creating it
|
/// Creates a database that will store its result in the [file], creating it
|
||||||
/// if it doesn't exist.
|
/// if it doesn't exist.
|
||||||
|
@ -253,15 +253,12 @@ class _NativeDelegate extends Sqlite3Delegate<Database> {
|
||||||
);
|
);
|
||||||
|
|
||||||
_NativeDelegate.opened(
|
_NativeDelegate.opened(
|
||||||
Database db,
|
Database super.db,
|
||||||
DatabaseSetup? setup,
|
super.setup,
|
||||||
bool closeUnderlyingWhenClosed,
|
super.closeUnderlyingWhenClosed,
|
||||||
bool cachePreparedStatements,
|
bool cachePreparedStatements,
|
||||||
) : file = null,
|
) : file = null,
|
||||||
super.opened(
|
super.opened(
|
||||||
db,
|
|
||||||
setup,
|
|
||||||
closeUnderlyingWhenClosed,
|
|
||||||
cachePreparedStatements: cachePreparedStatements,
|
cachePreparedStatements: cachePreparedStatements,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -135,8 +135,7 @@ abstract class _BaseExecutor extends QueryExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _RemoteQueryExecutor extends _BaseExecutor {
|
class _RemoteQueryExecutor extends _BaseExecutor {
|
||||||
_RemoteQueryExecutor(DriftClient client, [int? executorId])
|
_RemoteQueryExecutor(super.client, [super.executorId]);
|
||||||
: super(client, executorId);
|
|
||||||
|
|
||||||
Completer<void>? _setSchemaVersion;
|
Completer<void>? _setSchemaVersion;
|
||||||
Future<bool>? _serverIsOpen;
|
Future<bool>? _serverIsOpen;
|
||||||
|
@ -181,8 +180,7 @@ class _RemoteTransactionExecutor extends _BaseExecutor
|
||||||
implements TransactionExecutor {
|
implements TransactionExecutor {
|
||||||
final int? _outerExecutorId;
|
final int? _outerExecutorId;
|
||||||
|
|
||||||
_RemoteTransactionExecutor(DriftClient client, this._outerExecutorId)
|
_RemoteTransactionExecutor(super.client, this._outerExecutorId);
|
||||||
: super(client);
|
|
||||||
|
|
||||||
Completer<bool>? _pendingOpen;
|
Completer<bool>? _pendingOpen;
|
||||||
bool _done = false;
|
bool _done = false;
|
||||||
|
|
|
@ -59,14 +59,13 @@ abstract class GeneratedDatabase extends DatabaseConnectionUser
|
||||||
final Type _$dontSendThisOverIsolates = Null;
|
final Type _$dontSendThisOverIsolates = Null;
|
||||||
|
|
||||||
/// Used by generated code
|
/// Used by generated code
|
||||||
GeneratedDatabase(QueryExecutor executor, {StreamQueryStore? streamStore})
|
GeneratedDatabase(super.executor, {StreamQueryStore? streamStore})
|
||||||
: super(executor, streamQueries: streamStore) {
|
: super(streamQueries: streamStore) {
|
||||||
_whenConstructed();
|
_whenConstructed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used by generated code to connect to a database that is already open.
|
/// Used by generated code to connect to a database that is already open.
|
||||||
GeneratedDatabase.connect(DatabaseConnection connection)
|
GeneratedDatabase.connect(super.connection) : super.fromConnection() {
|
||||||
: super.fromConnection(connection) {
|
|
||||||
_whenConstructed();
|
_whenConstructed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,7 @@ class DeleteStatement<T extends Table, D> extends Query<T, D>
|
||||||
with SingleTableQueryMixin<T, D> {
|
with SingleTableQueryMixin<T, D> {
|
||||||
/// This constructor should be called by [DatabaseConnectionUser.delete] for
|
/// This constructor should be called by [DatabaseConnectionUser.delete] for
|
||||||
/// you.
|
/// you.
|
||||||
DeleteStatement(DatabaseConnectionUser database, TableInfo<T, D> table)
|
DeleteStatement(super.database, TableInfo<T, D> super.table);
|
||||||
: super(database, table);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void writeStartPart(GenerationContext ctx) {
|
void writeStartPart(GenerationContext ctx) {
|
||||||
|
|
|
@ -30,10 +30,7 @@ class SimpleSelectStatement<T extends HasResultSet, D> extends Query<T, D>
|
||||||
|
|
||||||
/// Used internally by drift, users will want to call
|
/// Used internally by drift, users will want to call
|
||||||
/// [DatabaseConnectionUser.select] instead.
|
/// [DatabaseConnectionUser.select] instead.
|
||||||
SimpleSelectStatement(
|
SimpleSelectStatement(super.database, super.table, {this.distinct = false});
|
||||||
DatabaseConnectionUser database, ResultSetImplementation<T, D> table,
|
|
||||||
{this.distinct = false})
|
|
||||||
: super(database, table);
|
|
||||||
|
|
||||||
/// The tables this select statement reads from.
|
/// The tables this select statement reads from.
|
||||||
@visibleForOverriding
|
@visibleForOverriding
|
||||||
|
|
|
@ -10,12 +10,10 @@ class JoinedSelectStatement<FirstT extends HasResultSet, FirstD>
|
||||||
implements BaseSelectStatement {
|
implements BaseSelectStatement {
|
||||||
/// Used internally by drift, users should use [SimpleSelectStatement.join]
|
/// Used internally by drift, users should use [SimpleSelectStatement.join]
|
||||||
/// instead.
|
/// instead.
|
||||||
JoinedSelectStatement(DatabaseConnectionUser database,
|
JoinedSelectStatement(super.database, super.table, this._joins,
|
||||||
ResultSetImplementation<FirstT, FirstD> table, this._joins,
|
|
||||||
[this.distinct = false,
|
[this.distinct = false,
|
||||||
this._includeMainTableInResult = true,
|
this._includeMainTableInResult = true,
|
||||||
this._includeJoinedTablesInResult = true])
|
this._includeJoinedTablesInResult = true]);
|
||||||
: super(database, table);
|
|
||||||
|
|
||||||
/// Whether to generate a `SELECT DISTINCT` query that will remove duplicate
|
/// Whether to generate a `SELECT DISTINCT` query that will remove duplicate
|
||||||
/// rows from the result set.
|
/// rows from the result set.
|
||||||
|
|
|
@ -4,8 +4,7 @@ part of '../query_builder.dart';
|
||||||
class UpdateStatement<T extends Table, D> extends Query<T, D>
|
class UpdateStatement<T extends Table, D> extends Query<T, D>
|
||||||
with SingleTableQueryMixin<T, D> {
|
with SingleTableQueryMixin<T, D> {
|
||||||
/// Used internally by drift, construct an update statement
|
/// Used internally by drift, construct an update statement
|
||||||
UpdateStatement(DatabaseConnectionUser database, TableInfo<T, D> table)
|
UpdateStatement(super.database, TableInfo<T, D> super.table);
|
||||||
: super(database, table);
|
|
||||||
|
|
||||||
late Map<String, Expression> _updatedFields;
|
late Map<String, Expression> _updatedFields;
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,8 @@ export 'src/web/wasm_setup/types.dart';
|
||||||
/// how to obtain this file. A [working example](https://github.com/simolus3/drift/blob/04539882330d80519128fec1ceb120fb1623a831/examples/app/lib/database/connection/web.dart#L27-L36)
|
/// how to obtain this file. A [working example](https://github.com/simolus3/drift/blob/04539882330d80519128fec1ceb120fb1623a831/examples/app/lib/database/connection/web.dart#L27-L36)
|
||||||
/// is also available in the drift repository.
|
/// is also available in the drift repository.
|
||||||
class WasmDatabase extends DelegatedDatabase {
|
class WasmDatabase extends DelegatedDatabase {
|
||||||
WasmDatabase._(DatabaseDelegate delegate, bool logStatements)
|
WasmDatabase._(super.delegate, bool logStatements)
|
||||||
: super(delegate, isSequential: true, logStatements: logStatements);
|
: super(isSequential: true, logStatements: logStatements);
|
||||||
|
|
||||||
/// Creates a wasm database at [path] in the virtual file system of the
|
/// Creates a wasm database at [path] in the virtual file system of the
|
||||||
/// [sqlite3] module.
|
/// [sqlite3] module.
|
||||||
|
|
|
@ -28,7 +28,7 @@ dev_dependencies:
|
||||||
drift_testcases:
|
drift_testcases:
|
||||||
path: ../extras/integration_tests/drift_testcases
|
path: ../extras/integration_tests/drift_testcases
|
||||||
http: ^0.13.4
|
http: ^0.13.4
|
||||||
lints: ^2.0.0
|
lints: ^3.0.0
|
||||||
uuid: ^4.0.0
|
uuid: ^4.0.0
|
||||||
build_runner: ^2.0.0
|
build_runner: ^2.0.0
|
||||||
test: ^1.17.0
|
test: ^1.17.0
|
||||||
|
|
|
@ -6,7 +6,7 @@ import '../generated/todos.dart';
|
||||||
import '../test_utils/test_utils.dart';
|
import '../test_utils/test_utils.dart';
|
||||||
|
|
||||||
class _FakeDb extends GeneratedDatabase {
|
class _FakeDb extends GeneratedDatabase {
|
||||||
_FakeDb(QueryExecutor executor) : super(executor);
|
_FakeDb(super.executor);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
MigrationStrategy get migration {
|
MigrationStrategy get migration {
|
||||||
|
|
|
@ -321,7 +321,7 @@ final class _FakeSchemaVersion extends VersionedSchema {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _DefaultDb extends GeneratedDatabase {
|
class _DefaultDb extends GeneratedDatabase {
|
||||||
_DefaultDb(QueryExecutor executor) : super(executor);
|
_DefaultDb(super.executor);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<TableInfo<Table, DataClass>> get allTables => [];
|
List<TableInfo<Table, DataClass>> get allTables => [];
|
||||||
|
|
|
@ -15,7 +15,7 @@ part 'custom_tables.g.dart';
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
class CustomTablesDb extends _$CustomTablesDb {
|
class CustomTablesDb extends _$CustomTablesDb {
|
||||||
CustomTablesDb(QueryExecutor e) : super(e) {
|
CustomTablesDb(super.e) {
|
||||||
driftRuntimeOptions.dontWarnAboutMultipleDatabases = true;
|
driftRuntimeOptions.dontWarnAboutMultipleDatabases = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -257,7 +257,7 @@ class TodoDb extends _$TodoDb {
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
class SomeDao extends DatabaseAccessor<TodoDb> with _$SomeDaoMixin {
|
class SomeDao extends DatabaseAccessor<TodoDb> with _$SomeDaoMixin {
|
||||||
SomeDao(TodoDb db) : super(db);
|
SomeDao(super.db);
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryExecutor get _nullExecutor =>
|
QueryExecutor get _nullExecutor =>
|
||||||
|
|
|
@ -35,7 +35,7 @@ DatabaseConnection createConnection() {
|
||||||
}
|
}
|
||||||
|
|
||||||
class EmptyDb extends GeneratedDatabase {
|
class EmptyDb extends GeneratedDatabase {
|
||||||
EmptyDb(DatabaseConnection c) : super(c);
|
EmptyDb(DatabaseConnection super.c);
|
||||||
@override
|
@override
|
||||||
final List<TableInfo> allTables = const [];
|
final List<TableInfo> allTables = const [];
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -495,8 +495,7 @@ void main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _TestDatabase extends GeneratedDatabase {
|
class _TestDatabase extends GeneratedDatabase {
|
||||||
_TestDatabase(QueryExecutor executor, this.schemaVersion, this.migration)
|
_TestDatabase(super.executor, this.schemaVersion, this.migration);
|
||||||
: super(executor);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Iterable<TableInfo<Table, dynamic>> get allTables => const Iterable.empty();
|
Iterable<TableInfo<Table, dynamic>> get allTables => const Iterable.empty();
|
||||||
|
|
|
@ -61,7 +61,7 @@ CREATE TABLE IF NOT EXISTS todo_categories (
|
||||||
}
|
}
|
||||||
|
|
||||||
class _Database extends GeneratedDatabase {
|
class _Database extends GeneratedDatabase {
|
||||||
_Database(QueryExecutor executor) : super(executor);
|
_Database(super.executor);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Iterable<TableInfo<Table, dynamic>> get allTables => const Iterable.empty();
|
Iterable<TableInfo<Table, dynamic>> get allTables => const Iterable.empty();
|
||||||
|
|
|
@ -3,7 +3,7 @@ import 'dart:io';
|
||||||
import '../cli.dart';
|
import '../cli.dart';
|
||||||
|
|
||||||
class AnalyzeCommand extends MoorCommand {
|
class AnalyzeCommand extends MoorCommand {
|
||||||
AnalyzeCommand(DriftDevCli cli) : super(cli);
|
AnalyzeCommand(super.cli);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get description => 'Analyze and lint drift database code';
|
String get description => 'Analyze and lint drift database code';
|
||||||
|
|
|
@ -7,7 +7,7 @@ import '../../analysis/results/results.dart';
|
||||||
import '../cli.dart';
|
import '../cli.dart';
|
||||||
|
|
||||||
class IdentifyDatabases extends MoorCommand {
|
class IdentifyDatabases extends MoorCommand {
|
||||||
IdentifyDatabases(DriftDevCli cli) : super(cli);
|
IdentifyDatabases(super.cli);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get description =>
|
String get description =>
|
||||||
|
|
|
@ -26,7 +26,7 @@ class MigrateCommand extends MoorCommand {
|
||||||
|
|
||||||
late final AnalysisContext context;
|
late final AnalysisContext context;
|
||||||
|
|
||||||
MigrateCommand(DriftDevCli cli) : super(cli);
|
MigrateCommand(super.cli);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get description => 'Migrate a project from moor to drift';
|
String get description => 'Migrate a project from moor to drift';
|
||||||
|
|
|
@ -86,7 +86,8 @@ class DumpSchemaCommand extends Command {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final elements = await extractDriftElementsFromDatabase(opened);
|
final elements = await extractDriftElementsFromDatabase(opened);
|
||||||
final userVersion = opened.select('pragma user_version').single[0] as int;
|
final userVersion =
|
||||||
|
opened.select('pragma user_version').single.columnAt(0) as int;
|
||||||
|
|
||||||
return _AnalyzedDatabase(elements, userVersion);
|
return _AnalyzedDatabase(elements, userVersion);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -85,7 +85,7 @@ class ModularAccessorWriter {
|
||||||
// Also make imports available
|
// Also make imports available
|
||||||
final imports = file.discovery?.importDependencies ?? const [];
|
final imports = file.discovery?.importDependencies ?? const [];
|
||||||
for (final import in imports) {
|
for (final import in imports) {
|
||||||
final file = driver.cache.knownFiles[import];
|
final file = driver.cache.knownFiles[import.uri];
|
||||||
|
|
||||||
if (file != null && file.needsModularAccessor(driver)) {
|
if (file != null && file.needsModularAccessor(driver)) {
|
||||||
final moduleClass = restOfClass.modularAccessor(import.uri);
|
final moduleClass = restOfClass.modularAccessor(import.uri);
|
||||||
|
|
|
@ -50,7 +50,7 @@ dependencies:
|
||||||
string_scanner: ^1.1.1
|
string_scanner: ^1.1.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
lints: ^2.0.0
|
lints: ^3.0.0
|
||||||
checked_yaml: ^2.0.1
|
checked_yaml: ^2.0.1
|
||||||
test: ^1.16.0
|
test: ^1.16.0
|
||||||
test_descriptor: ^2.0.0
|
test_descriptor: ^2.0.0
|
||||||
|
|
|
@ -42,8 +42,8 @@ class _TestDatabase extends GeneratedDatabase {
|
||||||
@override
|
@override
|
||||||
DriftDatabaseOptions options = DriftDatabaseOptions();
|
DriftDatabaseOptions options = DriftDatabaseOptions();
|
||||||
|
|
||||||
_TestDatabase.connect(DatabaseConnection connection)
|
_TestDatabase.connect(super.connection)
|
||||||
: super.connect(connection);
|
: super.connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
|
|
@ -80,7 +80,7 @@ class _TestDatabase extends GeneratedDatabase {
|
||||||
@override
|
@override
|
||||||
MigrationStrategy migration = MigrationStrategy();
|
MigrationStrategy migration = MigrationStrategy();
|
||||||
|
|
||||||
_TestDatabase(QueryExecutor executor, this.schemaVersion) : super(executor);
|
_TestDatabase(super.executor, this.schemaVersion);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Iterable<TableInfo<Table, DataClass>> get allTables {
|
Iterable<TableInfo<Table, DataClass>> get allTables {
|
||||||
|
|
|
@ -18,7 +18,7 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
integration_test:
|
integration_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_lints: ^2.0.0
|
flutter_lints: ^3.0.0
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
drift_testcases:
|
drift_testcases:
|
||||||
|
|
|
@ -19,7 +19,7 @@ void main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
const MyApp({Key? key}) : super(key: key);
|
const MyApp({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -35,7 +35,7 @@ class MyApp extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class HomePage extends StatefulWidget {
|
class HomePage extends StatefulWidget {
|
||||||
const HomePage({Key? key}) : super(key: key);
|
const HomePage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<HomePage> createState() => _HomePageState();
|
State<HomePage> createState() => _HomePageState();
|
||||||
|
@ -95,7 +95,7 @@ class _AddEntryDialog extends StatefulWidget {
|
||||||
// database around, but tiny example only wants to show how to use encryption.
|
// database around, but tiny example only wants to show how to use encryption.
|
||||||
final MyEncryptedDatabase database;
|
final MyEncryptedDatabase database;
|
||||||
|
|
||||||
const _AddEntryDialog({Key? key, required this.database}) : super(key: key);
|
const _AddEntryDialog({required this.database});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<_AddEntryDialog> createState() => _AddEntryDialogState();
|
State<_AddEntryDialog> createState() => _AddEntryDialogState();
|
||||||
|
|
|
@ -19,7 +19,7 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_lints: ^2.0.0
|
flutter_lints: ^3.0.0
|
||||||
drift_dev: ^2.0.2
|
drift_dev: ^2.0.2
|
||||||
build_runner: ^2.2.0
|
build_runner: ^2.2.0
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Database extends _$Database {
|
||||||
@override
|
@override
|
||||||
int get schemaVersion => latestSchemaVersion;
|
int get schemaVersion => latestSchemaVersion;
|
||||||
|
|
||||||
Database(DatabaseConnection connection) : super(connection);
|
Database(DatabaseConnection super.connection);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
MigrationStrategy get migration {
|
MigrationStrategy get migration {
|
||||||
|
|
|
@ -10,6 +10,6 @@ dependencies:
|
||||||
drift_dev:
|
drift_dev:
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
lints: ^2.0.0
|
lints: ^3.0.0
|
||||||
build_runner: ^2.0.0
|
build_runner: ^2.0.0
|
||||||
test: ^1.15.4
|
test: ^1.15.4
|
||||||
|
|
|
@ -11,5 +11,5 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
build_runner: ^2.3.2
|
build_runner: ^2.3.2
|
||||||
drift_dev:
|
drift_dev:
|
||||||
lints: ^2.0.0
|
lints: ^3.0.0
|
||||||
test: ^1.16.0
|
test: ^1.16.0
|
||||||
|
|
|
@ -14,5 +14,5 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
build_runner: ^2.1.11
|
build_runner: ^2.1.11
|
||||||
build_web_compilers: ^4.0.0
|
build_web_compilers: ^4.0.0
|
||||||
lints: ^2.0.0
|
lints: ^3.0.0
|
||||||
drift_dev:
|
drift_dev:
|
||||||
|
|
|
@ -27,7 +27,7 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_lints: ^2.0.0
|
flutter_lints: ^3.0.0
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|
|
@ -11,7 +11,7 @@ dependencies:
|
||||||
mysql_client: ^0.0.27
|
mysql_client: ^0.0.27
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
lints: ^2.0.0
|
lints: ^3.0.0
|
||||||
test: ^1.21.0
|
test: ^1.21.0
|
||||||
drift_testcases:
|
drift_testcases:
|
||||||
path: ../integration_tests/drift_testcases
|
path: ../integration_tests/drift_testcases
|
||||||
|
|
|
@ -88,7 +88,7 @@ class Database extends _$Database {
|
||||||
@override
|
@override
|
||||||
final int schemaVersion;
|
final int schemaVersion;
|
||||||
|
|
||||||
Database(DatabaseConnection e, {this.schemaVersion = 2}) : super(e);
|
Database(DatabaseConnection super.e, {this.schemaVersion = 2});
|
||||||
|
|
||||||
Database.executor(QueryExecutor db) : this(DatabaseConnection(db));
|
Database.executor(QueryExecutor db) : this(DatabaseConnection(db));
|
||||||
|
|
||||||
|
|
|
@ -15,4 +15,4 @@ dev_dependencies:
|
||||||
build_runner: ^2.1.11
|
build_runner: ^2.1.11
|
||||||
drift_dev: ^2.0.0
|
drift_dev: ^2.0.0
|
||||||
json_serializable: ^6.2.0
|
json_serializable: ^6.2.0
|
||||||
lints: ^2.0.0
|
lints: ^3.0.0
|
||||||
|
|
|
@ -23,5 +23,5 @@ dev_dependencies:
|
||||||
build_runner: ^2.4.5
|
build_runner: ^2.4.5
|
||||||
build_web_compilers: ^4.0.0
|
build_web_compilers: ^4.0.0
|
||||||
drift_dev:
|
drift_dev:
|
||||||
lints: ^2.0.0
|
lints: ^3.0.0
|
||||||
test: ^1.24.3
|
test: ^1.24.3
|
||||||
|
|
|
@ -44,11 +44,10 @@ class UnresolvedReferenceError extends AnalysisError {
|
||||||
final Iterable<String> available;
|
final Iterable<String> available;
|
||||||
|
|
||||||
UnresolvedReferenceError(
|
UnresolvedReferenceError(
|
||||||
{required AnalysisErrorType type,
|
{required super.type,
|
||||||
required this.reference,
|
required this.reference,
|
||||||
required this.available,
|
required this.available,
|
||||||
AstNode? relevantNode})
|
AstNode? super.relevantNode});
|
||||||
: super(type: type, relevantNode: relevantNode);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get message {
|
String get message {
|
||||||
|
|
|
@ -95,7 +95,7 @@ class NullColumnConstraint extends ColumnConstraint {
|
||||||
/// The `NULL` token forming this constraint.
|
/// The `NULL` token forming this constraint.
|
||||||
Token? $null;
|
Token? $null;
|
||||||
|
|
||||||
NullColumnConstraint(String? name, {this.$null}) : super(name);
|
NullColumnConstraint(super.name, {this.$null});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Iterable<AstNode> get childNodes => const Iterable.empty();
|
Iterable<AstNode> get childNodes => const Iterable.empty();
|
||||||
|
@ -110,7 +110,7 @@ class NotNull extends ColumnConstraint {
|
||||||
Token? not;
|
Token? not;
|
||||||
Token? $null;
|
Token? $null;
|
||||||
|
|
||||||
NotNull(String? name, {this.onConflict}) : super(name);
|
NotNull(super.name, {this.onConflict});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Iterable<AstNode> childNodes = const [];
|
final Iterable<AstNode> childNodes = const [];
|
||||||
|
@ -124,9 +124,8 @@ class PrimaryKeyColumn extends ColumnConstraint {
|
||||||
final ConflictClause? onConflict;
|
final ConflictClause? onConflict;
|
||||||
final OrderingMode? mode;
|
final OrderingMode? mode;
|
||||||
|
|
||||||
PrimaryKeyColumn(String? name,
|
PrimaryKeyColumn(super.name,
|
||||||
{this.autoIncrement = false, this.mode, this.onConflict})
|
{this.autoIncrement = false, this.mode, this.onConflict});
|
||||||
: super(name);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Iterable<AstNode> get childNodes => const [];
|
Iterable<AstNode> get childNodes => const [];
|
||||||
|
@ -138,7 +137,7 @@ class PrimaryKeyColumn extends ColumnConstraint {
|
||||||
class UniqueColumn extends ColumnConstraint {
|
class UniqueColumn extends ColumnConstraint {
|
||||||
final ConflictClause? onConflict;
|
final ConflictClause? onConflict;
|
||||||
|
|
||||||
UniqueColumn(String? name, this.onConflict) : super(name);
|
UniqueColumn(super.name, this.onConflict);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Iterable<AstNode> get childNodes => const [];
|
Iterable<AstNode> get childNodes => const [];
|
||||||
|
@ -150,7 +149,7 @@ class UniqueColumn extends ColumnConstraint {
|
||||||
class CheckColumn extends ColumnConstraint {
|
class CheckColumn extends ColumnConstraint {
|
||||||
Expression expression;
|
Expression expression;
|
||||||
|
|
||||||
CheckColumn(String? name, this.expression) : super(name);
|
CheckColumn(super.name, this.expression);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Iterable<AstNode> get childNodes => [expression];
|
Iterable<AstNode> get childNodes => [expression];
|
||||||
|
@ -164,7 +163,7 @@ class CheckColumn extends ColumnConstraint {
|
||||||
class Default extends ColumnConstraint {
|
class Default extends ColumnConstraint {
|
||||||
Expression expression;
|
Expression expression;
|
||||||
|
|
||||||
Default(String? name, this.expression) : super(name);
|
Default(super.name, this.expression);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Iterable<AstNode> get childNodes => [expression];
|
Iterable<AstNode> get childNodes => [expression];
|
||||||
|
@ -178,7 +177,7 @@ class Default extends ColumnConstraint {
|
||||||
class CollateConstraint extends ColumnConstraint {
|
class CollateConstraint extends ColumnConstraint {
|
||||||
final String collation;
|
final String collation;
|
||||||
|
|
||||||
CollateConstraint(String? name, this.collation) : super(name);
|
CollateConstraint(super.name, this.collation);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Iterable<AstNode> childNodes = const [];
|
final Iterable<AstNode> childNodes = const [];
|
||||||
|
@ -190,7 +189,7 @@ class CollateConstraint extends ColumnConstraint {
|
||||||
class ForeignKeyColumnConstraint extends ColumnConstraint {
|
class ForeignKeyColumnConstraint extends ColumnConstraint {
|
||||||
ForeignKeyClause clause;
|
ForeignKeyClause clause;
|
||||||
|
|
||||||
ForeignKeyColumnConstraint(String? name, this.clause) : super(name);
|
ForeignKeyColumnConstraint(super.name, this.clause);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Iterable<AstNode> get childNodes => [clause];
|
Iterable<AstNode> get childNodes => [clause];
|
||||||
|
@ -223,7 +222,7 @@ class MappedBy extends ColumnConstraint {
|
||||||
/// The Dart expression creating the type converter we use to map this token.
|
/// The Dart expression creating the type converter we use to map this token.
|
||||||
final InlineDartToken mapper;
|
final InlineDartToken mapper;
|
||||||
|
|
||||||
MappedBy(String? name, this.mapper) : super(name);
|
MappedBy(super.name, this.mapper);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Iterable<AstNode> childNodes = const [];
|
final Iterable<AstNode> childNodes = const [];
|
||||||
|
@ -243,7 +242,7 @@ class JsonKey extends ColumnConstraint {
|
||||||
|
|
||||||
String get jsonKey => jsonNameToken.identifier;
|
String get jsonKey => jsonNameToken.identifier;
|
||||||
|
|
||||||
JsonKey(String? name, this.jsonNameToken) : super(name);
|
JsonKey(super.name, this.jsonNameToken);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void transformChildren<A>(Transformer<A> transformer, A arg) {}
|
void transformChildren<A>(Transformer<A> transformer, A arg) {}
|
||||||
|
@ -259,7 +258,7 @@ class DriftDartName extends ColumnConstraint {
|
||||||
|
|
||||||
String get dartName => identifier.identifier;
|
String get dartName => identifier.identifier;
|
||||||
|
|
||||||
DriftDartName(String? name, this.identifier) : super(name);
|
DriftDartName(super.name, this.identifier);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void transformChildren<A>(Transformer<A> transformer, A arg) {}
|
void transformChildren<A>(Transformer<A> transformer, A arg) {}
|
||||||
|
|
|
@ -97,9 +97,8 @@ class KeyClause extends TableConstraint {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyClause(String? name,
|
KeyClause(super.name,
|
||||||
{required this.isPrimaryKey, required this.columns, this.onConflict})
|
{required this.isPrimaryKey, required this.columns, this.onConflict});
|
||||||
: super(name);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool constraintEquals(KeyClause other) {
|
bool constraintEquals(KeyClause other) {
|
||||||
|
@ -118,7 +117,7 @@ class KeyClause extends TableConstraint {
|
||||||
class CheckTable extends TableConstraint {
|
class CheckTable extends TableConstraint {
|
||||||
Expression expression;
|
Expression expression;
|
||||||
|
|
||||||
CheckTable(String? name, this.expression) : super(name);
|
CheckTable(super.name, this.expression);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool constraintEquals(CheckTable other) => true;
|
bool constraintEquals(CheckTable other) => true;
|
||||||
|
@ -136,9 +135,8 @@ class ForeignKeyTableConstraint extends TableConstraint {
|
||||||
List<Reference> columns;
|
List<Reference> columns;
|
||||||
ForeignKeyClause clause;
|
ForeignKeyClause clause;
|
||||||
|
|
||||||
ForeignKeyTableConstraint(String? name,
|
ForeignKeyTableConstraint(super.name,
|
||||||
{required this.columns, required this.clause})
|
{required this.columns, required this.clause});
|
||||||
: super(name);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool constraintEquals(ForeignKeyTableConstraint other) => true;
|
bool constraintEquals(ForeignKeyTableConstraint other) => true;
|
||||||
|
|
|
@ -8,7 +8,7 @@ abstract class BaseSelectStatement extends CrudStatement with ResultSet {
|
||||||
@override
|
@override
|
||||||
List<Column>? resolvedColumns;
|
List<Column>? resolvedColumns;
|
||||||
|
|
||||||
BaseSelectStatement._(WithClause? withClause) : super(withClause);
|
BaseSelectStatement._(super.withClause);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Marker interface for classes that are a [BaseSelectStatement] but aren't a
|
/// Marker interface for classes that are a [BaseSelectStatement] but aren't a
|
||||||
|
|
|
@ -114,20 +114,18 @@ class Fts5Table extends Table {
|
||||||
final String? contentRowId;
|
final String? contentRowId;
|
||||||
|
|
||||||
Fts5Table({
|
Fts5Table({
|
||||||
required String name,
|
required super.name,
|
||||||
required List<TableColumn> columns,
|
required List<TableColumn> columns,
|
||||||
this.contentTable,
|
this.contentTable,
|
||||||
this.contentRowId,
|
this.contentRowId,
|
||||||
CreateVirtualTableStatement? definition,
|
CreateVirtualTableStatement? super.definition,
|
||||||
}) : super(
|
}) : super(
|
||||||
name: name,
|
|
||||||
resolvedColumns: [
|
resolvedColumns: [
|
||||||
if (contentTable != null && contentRowId != null) RowId(),
|
if (contentTable != null && contentRowId != null) RowId(),
|
||||||
...columns,
|
...columns,
|
||||||
_Fts5RankColumn(),
|
_Fts5RankColumn(),
|
||||||
_Fts5TableColumn(name),
|
_Fts5TableColumn(name),
|
||||||
],
|
],
|
||||||
definition: definition,
|
|
||||||
isVirtual: true,
|
isVirtual: true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -508,7 +508,7 @@ class IdentifierToken extends Token {
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class VariableToken extends Token {
|
abstract class VariableToken extends Token {
|
||||||
VariableToken(TokenType type, FileSpan span) : super(type, span);
|
VariableToken(super.type, super.span);
|
||||||
}
|
}
|
||||||
|
|
||||||
class QuestionMarkVariableToken extends Token {
|
class QuestionMarkVariableToken extends Token {
|
||||||
|
@ -559,7 +559,7 @@ class KeywordToken extends Token {
|
||||||
/// Whether this token has been used as an identifier while parsing.
|
/// Whether this token has been used as an identifier while parsing.
|
||||||
bool isIdentifier = false;
|
bool isIdentifier = false;
|
||||||
|
|
||||||
KeywordToken(TokenType type, FileSpan span) : super(type, span);
|
KeywordToken(super.type, super.span);
|
||||||
|
|
||||||
bool canConvertToIdentifier() {
|
bool canConvertToIdentifier() {
|
||||||
// https://stackoverflow.com/a/45775719, but we don't parse indexed yet.
|
// https://stackoverflow.com/a/45775719, but we don't parse indexed yet.
|
||||||
|
|
|
@ -16,7 +16,7 @@ dependencies:
|
||||||
charcode: ^1.2.0
|
charcode: ^1.2.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
lints: ^2.0.0
|
lints: ^3.0.0
|
||||||
test: ^1.17.4
|
test: ^1.17.4
|
||||||
path: ^1.8.0
|
path: ^1.8.0
|
||||||
ffi: ^2.0.0
|
ffi: ^2.0.0
|
||||||
|
|
Loading…
Reference in New Issue