moor_generator 3.2.0

  • Readme
  • Changelog
  • Installing
  • 91

moor Generator #

This library contains the generator that turns your Table classes from moor into database code. When using the moor, you'll probably want to use the moor_flutter implementation directly.

Please see the homepage of moor or the moor_flutter package for details on how to use this package.

3.2.0 #

  • Support custom result class names for queries.
  • Fix minimum analyzer: ^0.39.5 version requirement

3.1.0 #

  • Respect foreign key constraints when calculating the stream update graph

3.0.0 #

Generate code for moor 3.0. This most notably includes custom companions and nested result sets. See moor's changelog for all the new features.

2.4.0 #

  • Support type converters in moor files. You can import the necessary Dart file with a regular import statement and then use MAPPED BY ``MyTypeConverter`` in a column definition.

2.3.1 #

  • CLI/IDE: Fix path resolution on Windows

2.3.0 #

  • Support explicit type arguments for queries in moor files. In foo(:bar AS TEXT, :baz AS INT): SELECT :bar, :baz;, the column type can now be inferred. Previously, the query would fail because of an unknown type.
  • Support CREATE TRIGGER and CREATE INDEX statements in moor files
  • Optional new type inference algorithm
  • CLI tool to analyze moor projects

2.2.0 #

  • Experimental new CLI tool (pub run moor_generator). Not useful at the moment
  • Support inheritance when defining daos (#285)
  • Improve robustness and error messages, many bug fixes

2.1.1 #

  • Fix a crash when using common table expressions in custom statements
  • Don't use a moor specific caching graph across build steps

2.1.0 #

  • Accept inheritance in table definitions (e.g. if an abstract class declared as IntColumn get foo => integer()(), tables inheriting from that class will also have a foo column)
  • New use_data_class_name_for_companions option that will make the name of the companion based on the data class name (uses table name by default).
  • New use_column_name_as_json_key_when_defined_in_moor_file option to use the column name instead of the Dart getter name as json key for columns declared in moor files

2.0.1 #

2.0.0 #

  • Rewritten generator with looser coupling to the build package
  • Implementation of an SQL IDE as analyzer plugin
  • Support sqlparser 0.3.0 and updated grammar for moor files

1.7.1 #

  • Drop support for analyzer versions <0.36.4. They weren't supported in version 1.7.0 either, but the pubspec.yaml did not specify this correctly.
  • Support for moor version 1.7.1, which contains a fix for integer columns declared as primary key

1.7.0 #

  • Support type converters that were introduced in moor 1.7
  • Support parsing and generating code for .moor files (see docs).

1.6.0+2 #

  • Generate code to expand array variables

The +1 release has no changes to 1.6.0, there were issues while uploading to pub. +2 fixes delivers on the promise of supporting the analyze 0.37

1.5.0 #

  • Parse custom queries and write generated mapping code.
  • Refactorings and minor improvements in the generator

For more details on the new features, check out changelog of the moor package.

1.4.0 #

  • Added the RealColumn, which stores floating point values
  • Better configuration for the serializer with the JsonKey annotation and the ability to use a custom ValueSerializer

1.3.0 #

  • Moor now supports table joins
    • Added table aliases
  • Default values for columns: Just use the withDefault method when declaring a column
    • added expressions that resolve to the current date or time
  • Fixed a crash that would occur if the first operation was a transaction
  • Better support for custom expressions as part of a regular query
  • Faster hashcode implementation in generated data classes

1.2.0 #

  • Blob data type
  • Generated classes now use lazy getters instead of recalculating fields on each access
  • Custom Constraints
  • Data classes can be converted from and to json

1.1.0 #

  • The generated data classes now implement toString()

1.0.0 #

  • Initial version of the Moor generator

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate moor_generator

2. Use it

The package has the following executables:


$ moor_generator

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  moor_generator: ^3.2.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:moor_generator/moor_generator.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
91
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
91
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13

Analysis suggestions

Package not compatible with SDK flutter

Because it is not compatible with any of the supported runtimes: flutter-native, flutter-web

Package not compatible with runtime flutter-native on android

Because of the import of dart:mirrors via the import chain package:moor_generator/moor_generator.dartpackage:moor_generator/src/model/model.dartpackage:moor_generator/src/model/used_type_converter.dartpackage:moor_generator/src/model/column.dartpackage:moor_generator/src/model/declarations/declaration.dartpackage:moor_generator/src/model/sources.dartpackage:moor_generator/src/analyzer/runner/file_graph.dartpackage:moor_generator/src/analyzer/errors.dartpackage:source_gen/source_gen.dartpackage:source_gen/src/type_checker.dartdart:mirrors

Package not compatible with runtime flutter-native on ios

Because of the import of dart:mirrors via the import chain package:moor_generator/moor_generator.dartpackage:moor_generator/src/model/model.dartpackage:moor_generator/src/model/used_type_converter.dartpackage:moor_generator/src/model/column.dartpackage:moor_generator/src/model/declarations/declaration.dartpackage:moor_generator/src/model/sources.dartpackage:moor_generator/src/analyzer/runner/file_graph.dartpackage:moor_generator/src/analyzer/errors.dartpackage:source_gen/source_gen.dartpackage:source_gen/src/type_checker.dartdart:mirrors

Package not compatible with runtime flutter-native on linux

Because of the import of dart:mirrors via the import chain package:moor_generator/moor_generator.dartpackage:moor_generator/src/model/model.dartpackage:moor_generator/src/model/used_type_converter.dartpackage:moor_generator/src/model/column.dartpackage:moor_generator/src/model/declarations/declaration.dartpackage:moor_generator/src/model/sources.dartpackage:moor_generator/src/analyzer/runner/file_graph.dartpackage:moor_generator/src/analyzer/errors.dartpackage:source_gen/source_gen.dartpackage:source_gen/src/type_checker.dartdart:mirrors

Package not compatible with runtime flutter-native on macos

Because of the import of dart:mirrors via the import chain package:moor_generator/moor_generator.dartpackage:moor_generator/src/model/model.dartpackage:moor_generator/src/model/used_type_converter.dartpackage:moor_generator/src/model/column.dartpackage:moor_generator/src/model/declarations/declaration.dartpackage:moor_generator/src/model/sources.dartpackage:moor_generator/src/analyzer/runner/file_graph.dartpackage:moor_generator/src/analyzer/errors.dartpackage:source_gen/source_gen.dartpackage:source_gen/src/type_checker.dartdart:mirrors

Package not compatible with runtime flutter-native on windows

Because of the import of dart:mirrors via the import chain package:moor_generator/moor_generator.dartpackage:moor_generator/src/model/model.dartpackage:moor_generator/src/model/used_type_converter.dartpackage:moor_generator/src/model/column.dartpackage:moor_generator/src/model/declarations/declaration.dartpackage:moor_generator/src/model/sources.dartpackage:moor_generator/src/analyzer/runner/file_graph.dartpackage:moor_generator/src/analyzer/errors.dartpackage:source_gen/source_gen.dartpackage:source_gen/src/type_checker.dartdart:mirrors

Package not compatible with runtime flutter-web on web

Because of the import of dart:io via the import chain package:moor_generator/moor_generator.dartpackage:moor_generator/src/model/model.dartpackage:moor_generator/src/model/used_type_converter.dartpackage:moor_generator/src/model/column.dartpackage:moor_generator/src/model/declarations/declaration.dartpackage:moor_generator/src/model/sources.dartpackage:moor_generator/src/analyzer/runner/file_graph.dartpackage:moor_generator/src/analyzer/errors.dartpackage:source_gen/source_gen.dartpackage:source_gen/src/utils.dartpackage:build/build.dartpackage:build/src/generate/run_post_process_builder.dartpackage:build/src/builder/post_process_builder.dartpackage:build/src/builder/builder.dartpackage:build/src/builder/build_step.dartpackage:build/src/asset/reader.dartpackage:glob/glob.dartpackage:glob/src/list_tree.dartpackage:glob/src/io.dartpackage:glob/src/io_export.dartdart:io

Package not compatible with runtime native-aot

Because of the import of dart:mirrors via the import chain package:moor_generator/moor_generator.dartpackage:moor_generator/src/model/model.dartpackage:moor_generator/src/model/used_type_converter.dartpackage:moor_generator/src/model/column.dartpackage:moor_generator/src/model/declarations/declaration.dartpackage:moor_generator/src/model/sources.dartpackage:moor_generator/src/analyzer/runner/file_graph.dartpackage:moor_generator/src/analyzer/errors.dartpackage:source_gen/source_gen.dartpackage:source_gen/src/type_checker.dartdart:mirrors

Package not compatible with runtime web

Because of the import of dart:io via the import chain package:moor_generator/moor_generator.dartpackage:moor_generator/src/model/model.dartpackage:moor_generator/src/model/used_type_converter.dartpackage:moor_generator/src/model/column.dartpackage:moor_generator/src/model/declarations/declaration.dartpackage:moor_generator/src/model/sources.dartpackage:moor_generator/src/analyzer/runner/file_graph.dartpackage:moor_generator/src/analyzer/errors.dartpackage:source_gen/source_gen.dartpackage:source_gen/src/utils.dartpackage:build/build.dartpackage:build/src/generate/run_post_process_builder.dartpackage:build/src/builder/post_process_builder.dartpackage:build/src/builder/builder.dartpackage:build/src/builder/build_step.dartpackage:build/src/asset/reader.dartpackage:glob/glob.dartpackage:glob/src/list_tree.dartpackage:glob/src/io.dartpackage:glob/src/io_export.dartdart:io

Health suggestions

Fix lib/src/backends/build/generators/moor_generator.dart. (-1 points)

Analysis of lib/src/backends/build/generators/moor_generator.dart reported 2 hints:

line 42 col 37: 'languageVersionMajor' is deprecated and shouldn't be used. Use 'languageVersion'.

line 43 col 37: 'languageVersionMinor' is deprecated and shouldn't be used. Use 'languageVersion'.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (cli_util).

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and moor_generator.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
analyzer ^0.39.5 0.39.11
analyzer_plugin ^0.2.4 0.2.4
args ^1.5.0 1.6.0
build ^1.1.0 1.3.0
build_config >=0.3.1 <1.0.0 0.4.2
build_resolvers ^1.3.3 1.3.9
cli_util ^0.1.0 0.1.4 0.2.0
collection ^1.14.0 1.14.13
json_annotation ^3.0.0 3.0.1
logging >=0.11.0 <1.0.0 0.11.4
meta ^1.1.0 1.1.8
moor ^3.0.0 3.2.0
path ^1.6.0 1.7.0
recase >=2.0.1 <4.0.0 3.0.0
source_gen ^0.9.4 0.9.5
source_span ^1.5.5 1.7.0
sqlparser ^0.10.0 0.10.0
stream_transform >=0.0.20 <2.0.0 1.2.0
Transitive dependencies
_fe_analyzer_shared 5.0.0
async 2.4.1
charcode 1.1.3
checked_yaml 1.0.2
convert 2.1.1
crypto 2.1.5
csslib 0.16.1
dart_style 1.3.6
glob 1.2.0
graphs 0.2.0
html 0.14.0+3
js 0.6.2
node_interop 1.1.1
node_io 1.1.1
package_config 1.9.3
pedantic 1.9.0 1.9.1
pub_semver 1.4.4
pubspec_parse 0.1.5
string_scanner 1.0.5
synchronized 2.2.0+1
term_glyph 1.1.0
typed_data 1.2.0
watcher 0.9.7+15
yaml 2.2.1
Dev dependencies
build_runner ^1.6.7
build_test ^0.10.10
json_serializable ^3.0.0
test ^1.6.0