Generator: Extract writer into a top-level library

This commit is contained in:
Simon Binder 2019-12-11 10:44:28 +01:00
parent 99cf31bb61
commit bdea374fa2
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
11 changed files with 25 additions and 21 deletions

View File

@ -6,7 +6,6 @@ analyzer:
unused_import: error
unused_local_variable: error
dead_code: error
override_on_non_overriding_method: error
public_member_api_docs: ignore # turned on by user-facing subpackages
exclude:
- "**/*.g.dart"

View File

@ -1,6 +1,6 @@
import 'package:build/build.dart';
import 'package:moor_generator/src/backends/build/moor_builder.dart';
import 'package:moor_generator/src/writer/queries/query_writer.dart';
import 'package:moor_generator/writer.dart';
import 'package:source_gen/source_gen.dart';
class DaoGenerator extends Generator implements BaseGenerator {

View File

@ -1,6 +1,6 @@
import 'package:build/build.dart';
import 'package:moor_generator/src/backends/build/moor_builder.dart';
import 'package:moor_generator/src/writer/database_writer.dart';
import 'package:moor_generator/writer.dart';
import 'package:source_gen/source_gen.dart';
const _ignoredLints = [

View File

@ -5,7 +5,7 @@ import 'package:moor_generator/src/analyzer/session.dart';
import 'package:moor_generator/src/backends/build/build_backend.dart';
import 'package:moor_generator/src/backends/build/generators/dao_generator.dart';
import 'package:moor_generator/src/backends/build/generators/moor_generator.dart';
import 'package:moor_generator/src/writer/writer.dart';
import 'package:moor_generator/writer.dart';
import 'package:source_gen/source_gen.dart';
class MoorBuilder extends SharedPartBuilder {

View File

@ -1,8 +1,5 @@
import 'package:moor_generator/src/model/specified_db_classes.dart';
import 'package:moor_generator/src/writer/queries/query_writer.dart';
import 'package:moor_generator/src/writer/tables/table_writer.dart';
import 'package:moor_generator/src/writer/utils/memoized_getter.dart';
import 'package:moor_generator/src/writer/writer.dart';
import 'package:moor_generator/writer.dart';
import 'package:recase/recase.dart';
/// Generates the Dart code put into a `.g.dart` file when running the

View File

@ -4,8 +4,7 @@ import 'package:moor_generator/src/analyzer/options.dart';
import 'package:moor_generator/src/model/specified_column.dart';
import 'package:moor_generator/src/model/sql_query.dart';
import 'package:moor_generator/src/utils/string_escaper.dart';
import 'package:moor_generator/src/writer/queries/result_set_writer.dart';
import 'package:moor_generator/src/writer/writer.dart';
import 'package:moor_generator/writer.dart';
import 'package:recase/recase.dart';
import 'package:sqlparser/sqlparser.dart' hide ResultColumn;

View File

@ -1,7 +1,5 @@
import 'package:moor_generator/src/model/sql_query.dart';
import 'package:moor_generator/src/writer/utils/hash_code.dart';
import 'package:moor_generator/src/writer/utils/override_equals.dart';
import 'package:moor_generator/src/writer/writer.dart';
import 'package:moor_generator/writer.dart';
/// Writes a class holding the result of an sql query into Dart.
class ResultSetWriter {

View File

@ -1,7 +1,5 @@
import 'package:moor_generator/src/model/specified_table.dart';
import 'package:moor_generator/src/writer/utils/hash_code.dart';
import 'package:moor_generator/src/writer/utils/override_equals.dart';
import 'package:moor_generator/src/writer/writer.dart';
import 'package:moor_generator/writer.dart';
import 'package:recase/recase.dart';
class DataClassWriter {

View File

@ -1,10 +1,7 @@
import 'package:moor_generator/src/model/specified_column.dart';
import 'package:moor_generator/src/model/specified_table.dart';
import 'package:moor_generator/src/utils/string_escaper.dart';
import 'package:moor_generator/src/writer/tables/data_class_writer.dart';
import 'package:moor_generator/src/writer/tables/update_companion_writer.dart';
import 'package:moor_generator/src/writer/utils/memoized_getter.dart';
import 'package:moor_generator/src/writer/writer.dart';
import 'package:moor_generator/writer.dart';
import 'package:sqlparser/sqlparser.dart';
class TableWriter {

View File

@ -1,6 +1,6 @@
import 'package:moor_generator/src/model/specified_column.dart';
import 'package:moor_generator/src/model/specified_table.dart';
import 'package:moor_generator/src/writer/writer.dart';
import 'package:moor_generator/writer.dart';
class UpdateCompanionWriter {
final SpecifiedTable table;

View File

@ -0,0 +1,16 @@
/// Provides access to the [Writer], which can generate Dart code for parsed
/// databases, daos, queries, tables and more.
library writer;
import 'src/writer/writer.dart' show Writer;
export 'src/writer/database_writer.dart';
export 'src/writer/queries/query_writer.dart';
export 'src/writer/queries/result_set_writer.dart';
export 'src/writer/tables/data_class_writer.dart';
export 'src/writer/tables/table_writer.dart';
export 'src/writer/tables/update_companion_writer.dart';
export 'src/writer/utils/hash_code.dart';
export 'src/writer/utils/memoized_getter.dart';
export 'src/writer/utils/override_equals.dart';
export 'src/writer/writer.dart';