From bba3948a2bcc911c4da9a8c532c7ec2af3d67f3b Mon Sep 17 00:00:00 2001 From: thomashii Date: Fri, 18 Jun 2021 18:29:49 +0800 Subject: [PATCH] Published orm_service --- packages/orm/angel_orm_service/CHANGELOG.md | 2 +- packages/orm/angel_orm_service/README.md | 11 ++-- .../angel_orm_service/example/connect.dart | 2 +- .../orm/angel_orm_service/example/main.dart | 6 +- .../angel_orm_service/example/migrate.dart | 4 +- .../orm/angel_orm_service/example/todo.dart | 6 +- ...m_service.dart => angel3_orm_service.dart} | 14 ++--- packages/orm/angel_orm_service/pubspec.yaml | 55 +++++-------------- .../orm/angel_orm_service/test/all_test.dart | 6 +- .../orm/angel_orm_service/test/pokemon.dart | 6 +- 10 files changed, 43 insertions(+), 69 deletions(-) rename packages/orm/angel_orm_service/lib/{angel_orm_service.dart => angel3_orm_service.dart} (93%) diff --git a/packages/orm/angel_orm_service/CHANGELOG.md b/packages/orm/angel_orm_service/CHANGELOG.md index e27f0900..36650424 100644 --- a/packages/orm/angel_orm_service/CHANGELOG.md +++ b/packages/orm/angel_orm_service/CHANGELOG.md @@ -1,4 +1,4 @@ -# 2.0.0 +# 2.0.0-beta.1 * Migrated to support Dart SDK 2.12.x NNBD # 1.0.0 diff --git a/packages/orm/angel_orm_service/README.md b/packages/orm/angel_orm_service/README.md index 946e7fff..e341ba49 100644 --- a/packages/orm/angel_orm_service/README.md +++ b/packages/orm/angel_orm_service/README.md @@ -1,6 +1,9 @@ -# angel_orm_service -[![Pub](https://img.shields.io/pub/v/angel_orm_service.svg)](https://pub.dartlang.org/packages/angel_orm_service) -[![build status](https://travis-ci.org/angel-dart/orm.svg)](https://travis-ci.org/angel-dart/orm) +# angel3_orm_service +[![version](https://img.shields.io/badge/pub-v2.0.0-brightgreen)](https://pub.dartlang.org/packages/angel3_orm_service) +[![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/angel_orm_service/LICENSE) Service implementation that wraps over Angel ORM Query classes. @@ -9,7 +12,7 @@ In your `pubspec.yaml`: ```yaml dependencies: - angel_orm_service: ^1.0.0 + angel3_orm_service: ^2.0.0-beta.1 ``` ## Usage diff --git a/packages/orm/angel_orm_service/example/connect.dart b/packages/orm/angel_orm_service/example/connect.dart index 214e3762..f10f3967 100644 --- a/packages/orm/angel_orm_service/example/connect.dart +++ b/packages/orm/angel_orm_service/example/connect.dart @@ -1,6 +1,6 @@ import 'dart:async'; import 'dart:io'; -import 'package:angel_orm_postgres/angel_orm_postgres.dart'; +import 'package:angel3_orm_postgres/angel3_orm_postgres.dart'; import 'package:postgres/postgres.dart'; final conn = PostgreSQLConnection('localhost', 5432, 'angel_orm_service_test', diff --git a/packages/orm/angel_orm_service/example/main.dart b/packages/orm/angel_orm_service/example/main.dart index a383747e..1def5eed 100644 --- a/packages/orm/angel_orm_service/example/main.dart +++ b/packages/orm/angel_orm_service/example/main.dart @@ -1,6 +1,6 @@ -import 'package:angel_framework/angel_framework.dart'; -import 'package:angel_framework/http.dart'; -import 'package:angel_orm_service/angel_orm_service.dart'; +import 'package:angel3_framework/angel3_framework.dart'; +import 'package:angel3_framework/http.dart'; +import 'package:angel3_orm_service/angel3_orm_service.dart'; import 'package:logging/logging.dart'; import 'connect.dart'; import 'todo.dart'; diff --git a/packages/orm/angel_orm_service/example/migrate.dart b/packages/orm/angel_orm_service/example/migrate.dart index 802a4e2f..9422c555 100644 --- a/packages/orm/angel_orm_service/example/migrate.dart +++ b/packages/orm/angel_orm_service/example/migrate.dart @@ -1,5 +1,5 @@ -import 'package:angel_migration_runner/angel_migration_runner.dart'; -import 'package:angel_migration_runner/postgres.dart'; +import 'package:angel3_migration_runner/angel3_migration_runner.dart'; +import 'package:angel3_migration_runner/postgres.dart'; import 'connect.dart'; import 'todo.dart'; diff --git a/packages/orm/angel_orm_service/example/todo.dart b/packages/orm/angel_orm_service/example/todo.dart index b9cc1bec..f38c082f 100644 --- a/packages/orm/angel_orm_service/example/todo.dart +++ b/packages/orm/angel_orm_service/example/todo.dart @@ -1,6 +1,6 @@ -import 'package:angel_migration/angel_migration.dart'; -import 'package:angel_serialize/angel_serialize.dart'; -import 'package:angel_orm/angel_orm.dart'; +import 'package:angel3_migration/angel3_migration.dart'; +import 'package:angel3_serialize/angel3_serialize.dart'; +import 'package:angel3_orm/angel3_orm.dart'; import 'package:optional/optional.dart'; part 'todo.g.dart'; diff --git a/packages/orm/angel_orm_service/lib/angel_orm_service.dart b/packages/orm/angel_orm_service/lib/angel3_orm_service.dart similarity index 93% rename from packages/orm/angel_orm_service/lib/angel_orm_service.dart rename to packages/orm/angel_orm_service/lib/angel3_orm_service.dart index 0403cbdc..91a5643f 100644 --- a/packages/orm/angel_orm_service/lib/angel_orm_service.dart +++ b/packages/orm/angel_orm_service/lib/angel3_orm_service.dart @@ -1,6 +1,6 @@ import 'dart:async'; -import 'package:angel_framework/angel_framework.dart' hide Query; -import 'package:angel_orm/angel_orm.dart'; +import 'package:angel3_framework/angel3_framework.dart' hide Query; +import 'package:angel3_orm/angel3_orm.dart'; /// A [Service] implementation that wraps over a [Query] class generated /// via the Angel ORM. @@ -40,7 +40,7 @@ class OrmService> return query.where!.expressionBuilders.firstWhere( (b) => b.columnName == name, orElse: (() => throw ArgumentError( - '${query.where.runtimeType} has no expression builder for a column named "$name".')) as SqlExpressionBuilder Function()?); + '${query.where.runtimeType} has no expression builder for a column named "$name".'))); } void _apply(TQuery query, String name, dynamic value) { @@ -119,7 +119,7 @@ class OrmService> _apply(query, idField, id); await _applyQuery(query, params); var result = await query.getOne(executor); - if (result != null && result.isPresent) return result.value; + if (result.isPresent) return result.value; throw AngelHttpException.notFound(message: 'No record found for ID $id'); } @@ -131,7 +131,7 @@ class OrmService> var query = await queryCreator(); await _applyQuery(query, params); var result = await query.getOne(executor); - if (result != null && result.isPresent) return result.value; + if (result.isPresent) return result.value; throw AngelHttpException.notFound(message: errorMessage); } @@ -170,7 +170,7 @@ class OrmService> } var result = await query.updateOne(executor); - if (result != null) return result.value; + if (result.isPresent) return result.value; throw AngelHttpException.notFound(message: 'No record found for ID $id'); } @@ -191,7 +191,7 @@ class OrmService> } var result = await query.deleteOne(executor); - if (result != null && result.isPresent) return result.value; + if (result.isPresent) return result.value; throw AngelHttpException.notFound(message: 'No record found for ID $id'); } } diff --git a/packages/orm/angel_orm_service/pubspec.yaml b/packages/orm/angel_orm_service/pubspec.yaml index 0a6397f9..c93fcf3a 100644 --- a/packages/orm/angel_orm_service/pubspec.yaml +++ b/packages/orm/angel_orm_service/pubspec.yaml @@ -1,54 +1,25 @@ -name: angel_orm_service -version: 2.0.0 -description: Service implementation that wraps over Angel ORM Query classes. -homepage: https://github.com/angel-dart/orm -publish_to: none +name: angel3_orm_service +version: 2.0.0-beta.1 +description: Service implementation that wraps over Angel3 ORM Query classes. +homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/orm/angel_orm_service environment: sdk: '>=2.12.0 <3.0.0' dependencies: - angel_framework: - git: - url: https://github.com/dukefirehawk/angel.git - ref: sdk-2.12.x_nnbd - path: packages/framework - angel_orm: - git: - url: https://github.com/dukefirehawk/angel.git - ref: sdk-2.12.x_nnbd - path: packages/orm/angel_orm + angel3_framework: ^4.0.0 + angel3_orm: ^4.0.0-beta.1 postgres: ^2.3.2 optional: ^6.0.0-nullsafety.2 dev_dependencies: - angel_migration: + angel3_migration: ^4.0.0-beta.1 + angel3_migration_runner: ^4.0.0-beta.1 + angel3_orm_generator: ^4.0.0-beta.1 + angel3_orm_postgres: ^3.0.0-beta.1 + angel3_serialize: ^4.0.0 + angel3_orm_test: git: url: https://github.com/dukefirehawk/angel.git - ref: sdk-2.12.x_nnbd - path: packages/orm/angel_migration - angel_migration_runner: - git: - url: https://github.com/dukefirehawk/angel.git - ref: sdk-2.12.x_nnbd - path: packages/orm/angel_migration_runner - angel_orm_generator: - git: - url: https://github.com/dukefirehawk/angel.git - ref: sdk-2.12.x_nnbd - path: packages/orm/angel_orm_generator - angel_orm_postgres: - git: - url: https://github.com/dukefirehawk/angel.git - ref: sdk-2.12.x_nnbd - path: packages/orm/angel_orm_postgres - angel_orm_test: - git: - url: https://github.com/dukefirehawk/angel.git - ref: sdk-2.12.x_nnbd + ref: angel3 path: packages/orm/angel_orm_test - angel_serialize: - git: - url: https://github.com/dukefirehawk/angel.git - ref: sdk-2.12.x_nnbd - path: packages/serialize/angel_serialize build_runner: ^2.0.4 logging: ^1.0.1 pedantic: ^1.11.0 diff --git a/packages/orm/angel_orm_service/test/all_test.dart b/packages/orm/angel_orm_service/test/all_test.dart index 699e2126..8557d17c 100644 --- a/packages/orm/angel_orm_service/test/all_test.dart +++ b/packages/orm/angel_orm_service/test/all_test.dart @@ -1,8 +1,8 @@ import 'dart:async'; import 'dart:io'; -import 'package:angel_framework/angel_framework.dart'; -import 'package:angel_orm_postgres/angel_orm_postgres.dart'; -import 'package:angel_orm_service/angel_orm_service.dart'; +import 'package:angel3_framework/angel3_framework.dart'; +import 'package:angel3_orm_postgres/angel3_orm_postgres.dart'; +import 'package:angel3_orm_service/angel3_orm_service.dart'; import 'package:logging/logging.dart'; import 'package:postgres/postgres.dart'; import 'package:test/test.dart'; diff --git a/packages/orm/angel_orm_service/test/pokemon.dart b/packages/orm/angel_orm_service/test/pokemon.dart index 0734184c..b4ce08a6 100644 --- a/packages/orm/angel_orm_service/test/pokemon.dart +++ b/packages/orm/angel_orm_service/test/pokemon.dart @@ -1,6 +1,6 @@ -import 'package:angel_migration/angel_migration.dart'; -import 'package:angel_serialize/angel_serialize.dart'; -import 'package:angel_orm/angel_orm.dart'; +import 'package:angel3_migration/angel3_migration.dart'; +import 'package:angel3_serialize/angel3_serialize.dart'; +import 'package:angel3_orm/angel3_orm.dart'; import 'package:optional/optional.dart'; part 'pokemon.g.dart';