Updated orm_generator

This commit is contained in:
thomashii 2021-05-18 00:03:26 +08:00
parent ebdb634a95
commit e88faa03ae
9 changed files with 41 additions and 67 deletions

View file

@ -1,4 +1,4 @@
# 4.0.0 # 4.0.0-beta.1
* Migrated to support Dart SDK 2.12.x NNBD * Migrated to support Dart SDK 2.12.x NNBD
# 3.0.0 # 3.0.0

View file

@ -1,4 +1,10 @@
# angel_orm_generator # angel3_orm_generator
[![version](https://img.shields.io/badge/pub-v4.0.0-brightgreen)](https://pub.dartlang.org/packages/angel3_orm_generator)
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
[![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion)
[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/angel3/packages/orm/angel3_orm_generator/LICENSE)
Source code generators for Angel's ORM. Source code generators for Angel's ORM.
This package can generate: This package can generate:
* A strongly-typed ORM * A strongly-typed ORM

View file

@ -1,9 +1,9 @@
import 'dart:async'; import 'dart:async';
import 'package:angel_migration/angel_migration.dart'; import 'package:angel3_migration/angel3_migration.dart';
import 'package:angel_model/angel_model.dart'; import 'package:angel3_model/angel3_model.dart';
import 'package:angel_orm/angel_orm.dart'; import 'package:angel3_orm/angel3_orm.dart';
import 'package:angel_orm/src/query.dart'; import 'package:angel3_orm/src/query.dart';
import 'package:angel_serialize/angel_serialize.dart'; import 'package:angel3_serialize/angel3_serialize.dart';
import 'package:optional/optional.dart'; import 'package:optional/optional.dart';
part 'main.g.dart'; part 'main.g.dart';

View file

@ -1,9 +1,9 @@
import 'dart:async'; import 'dart:async';
import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart'; import 'package:analyzer/dart/element/type.dart';
import 'package:angel_model/angel_model.dart'; import 'package:angel3_model/angel3_model.dart';
import 'package:angel_orm/angel_orm.dart'; import 'package:angel3_orm/angel3_orm.dart';
import 'package:angel_serialize_generator/angel_serialize_generator.dart'; import 'package:angel3_serialize_generator/angel3_serialize_generator.dart';
import 'package:build/build.dart'; import 'package:build/build.dart';
import 'package:code_builder/code_builder.dart'; import 'package:code_builder/code_builder.dart';
import 'package:dart_style/dart_style.dart'; import 'package:dart_style/dart_style.dart';

View file

@ -3,15 +3,15 @@ import 'dart:async';
import 'package:analyzer/dart/constant/value.dart'; import 'package:analyzer/dart/constant/value.dart';
import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart'; import 'package:analyzer/dart/element/type.dart';
import 'package:angel_model/angel_model.dart'; import 'package:angel3_model/angel3_model.dart';
import 'package:angel_orm/angel_orm.dart'; import 'package:angel3_orm/angel3_orm.dart';
import 'package:angel_serialize/angel_serialize.dart'; import 'package:angel3_serialize/angel3_serialize.dart';
import 'package:angel_serialize_generator/angel_serialize_generator.dart'; import 'package:angel3_serialize_generator/angel3_serialize_generator.dart';
import 'package:angel_serialize_generator/build_context.dart'; import 'package:angel3_serialize_generator/build_context.dart';
import 'package:angel_serialize_generator/context.dart'; import 'package:angel3_serialize_generator/context.dart';
import 'package:build/build.dart'; import 'package:build/build.dart';
import 'package:collection/collection.dart' show IterableExtension; import 'package:collection/collection.dart' show IterableExtension;
import 'package:inflection2/inflection2.dart'; import 'package:inflection3/inflection3.dart';
import 'package:recase/recase.dart'; import 'package:recase/recase.dart';
import 'package:source_gen/source_gen.dart'; import 'package:source_gen/source_gen.dart';
@ -114,16 +114,13 @@ Future<OrmBuildContext?> buildOrmContext(
type: ColumnType.serial, indexType: IndexType.primaryKey); type: ColumnType.serial, indexType: IndexType.primaryKey);
} }
if (column == null) { column ??= Column(
// Guess what kind of column this is... type: inferColumnType(
column = Column( buildCtx.resolveSerializedFieldType(field.name),
type: inferColumnType( ),
buildCtx.resolveSerializedFieldType(field.name), );
),
);
}
if (column != null && column.type == null) { if (column.type == null) {
column = Column( column = Column(
isNullable: column.isNullable, isNullable: column.isNullable,
length: column.length, length: column.length,

View file

@ -1,8 +1,8 @@
import 'dart:async'; import 'dart:async';
import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart'; import 'package:analyzer/dart/element/type.dart';
import 'package:angel_orm/angel_orm.dart'; import 'package:angel3_orm/angel3_orm.dart';
import 'package:angel_serialize_generator/angel_serialize_generator.dart'; import 'package:angel3_serialize_generator/angel3_serialize_generator.dart';
import 'package:build/build.dart'; import 'package:build/build.dart';
import 'package:code_builder/code_builder.dart' hide LibraryBuilder; import 'package:code_builder/code_builder.dart' hide LibraryBuilder;
import 'package:source_gen/source_gen.dart'; import 'package:source_gen/source_gen.dart';

View file

@ -1,7 +1,7 @@
import 'package:analyzer/dart/constant/value.dart'; import 'package:analyzer/dart/constant/value.dart';
import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart'; import 'package:analyzer/dart/element/type.dart';
import 'package:angel_orm/angel_orm.dart'; import 'package:angel3_orm/angel3_orm.dart';
import 'package:source_gen/source_gen.dart'; import 'package:source_gen/source_gen.dart';
import 'orm_build_context.dart'; import 'orm_build_context.dart';

View file

@ -1,37 +1,16 @@
name: angel_orm_generator name: angel_orm_generator
version: 4.0.0 version: 4.0.0-beta.1
description: Code generators for Angel's ORM. Generates query builder classes. description: Code generators for Angel's ORM. Generates query builder classes.
homepage: https://github.com/dukefirehawk/angel homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/orm/angel3_orm_generator
publish_to: none
environment: environment:
sdk: '>=2.12.0 <3.0.0' sdk: '>=2.12.0 <3.0.0'
dependencies: dependencies:
analyzer: ^1.5.0 analyzer: ^1.5.0
angel_model: angel3_model: ^3.0.0
git: angel3_serialize: ^4.0.0
url: https://github.com/dukefirehawk/angel.git angel3_orm: ^4.0.0-beta.1
ref: sdk-2.12.x_nnbd angel3_serialize_generator: ^4.0.0
path: packages/model inflection3: ^0.5.3+1
angel_serialize:
git:
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x_nnbd
path: packages/serialize/angel_serialize
angel_orm:
git:
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x_nnbd
path: packages/orm/angel_orm
angel_serialize_generator:
git:
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x_nnbd
path: packages/serialize/angel_serialize_generator
inflection2:
git:
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x_nnbd
path: packages/inflection2
build: ^2.0.1 build: ^2.0.1
build_config: ^1.0.0 build_config: ^1.0.0
code_builder: ^4.0.0 code_builder: ^4.0.0
@ -42,16 +21,8 @@ dependencies:
source_gen: ^1.0.0 source_gen: ^1.0.0
collection: ^1.15.0 collection: ^1.15.0
dev_dependencies: dev_dependencies:
angel_framework: angel3_framework: ^4.0.0
git: angel3_migration: ^4.0.0-beta.1
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x_nnbd
path: packages/framework
angel_migration:
git:
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x_nnbd
path: packages/orm/angel_migration
#angel_test: ^1.0.0 #angel_test: ^1.0.0
build_runner: ^2.0.1 build_runner: ^2.0.1
pedantic: ^1.11.0 pedantic: ^1.11.0