From d57dbae6f926daf0db5ca39d2e93c338381515a8 Mon Sep 17 00:00:00 2001 From: Thomas Hii Date: Mon, 24 Jun 2024 07:54:16 +0800 Subject: [PATCH] Fixed anlyzer warnings --- packages/orm/angel_orm_generator/CHANGELOG.md | 4 ++++ .../lib/src/orm_build_context.dart | 2 +- .../lib/src/orm_generator.dart | 2 +- packages/orm/angel_orm_generator/pubspec.yaml | 2 +- packages/orm/angel_orm_postgres/CHANGELOG.md | 4 ++++ packages/orm/angel_orm_postgres/README.md | 4 +++- .../lib/src/orm_postgres.dart | 4 +--- .../lib/src/orm_postgres_pool.dart | 2 +- packages/orm/angel_orm_postgres/pubspec.yaml | 4 ++-- packages/orm/angel_orm_service/CHANGELOG.md | 2 +- packages/orm/angel_orm_service/pubspec.yaml | 2 +- packages/orm/angel_orm_test/CHANGELOG.md | 4 ++++ .../lib/src/many_to_many_test.dart | 21 ++----------------- packages/orm/angel_orm_test/pubspec.yaml | 14 ++++++------- 14 files changed, 33 insertions(+), 38 deletions(-) diff --git a/packages/orm/angel_orm_generator/CHANGELOG.md b/packages/orm/angel_orm_generator/CHANGELOG.md index 612c4fc6..b993bafa 100644 --- a/packages/orm/angel_orm_generator/CHANGELOG.md +++ b/packages/orm/angel_orm_generator/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 8.3.2 + +* Fixed analyzer warnings + ## 8.3.1 * Updated dependencies diff --git a/packages/orm/angel_orm_generator/lib/src/orm_build_context.dart b/packages/orm/angel_orm_generator/lib/src/orm_build_context.dart index 49bcdb47..f2c6299e 100644 --- a/packages/orm/angel_orm_generator/lib/src/orm_build_context.dart +++ b/packages/orm/angel_orm_generator/lib/src/orm_build_context.dart @@ -219,7 +219,7 @@ Future buildOrmContext( } } on StackOverflowError { throw UnsupportedError( - 'There is an infinite cycle between ${clazz.name} and ${field.type.getDisplayString(withNullability: true)}. This triggered a stack overflow.'); + 'There is an infinite cycle between ${clazz.name} and ${field.type.getDisplayString()}. This triggered a stack overflow.'); } } } diff --git a/packages/orm/angel_orm_generator/lib/src/orm_generator.dart b/packages/orm/angel_orm_generator/lib/src/orm_generator.dart index e83507e5..7054ed36 100644 --- a/packages/orm/angel_orm_generator/lib/src/orm_generator.dart +++ b/packages/orm/angel_orm_generator/lib/src/orm_generator.dart @@ -745,7 +745,7 @@ class OrmGenerator extends GeneratorForAnnotation { if (const TypeChecker.fromRuntime(int).isExactlyType(type) || const TypeChecker.fromRuntime(double).isExactlyType(type) || isSpecialId(ctx, field)) { - var typeName = type.getDisplayString(withNullability: false); + var typeName = type.getDisplayString(); if (isSpecialId(ctx, field)) { typeName = 'int'; } diff --git a/packages/orm/angel_orm_generator/pubspec.yaml b/packages/orm/angel_orm_generator/pubspec.yaml index 5a66444e..88b8cbf0 100644 --- a/packages/orm/angel_orm_generator/pubspec.yaml +++ b/packages/orm/angel_orm_generator/pubspec.yaml @@ -1,5 +1,5 @@ name: angel3_orm_generator -version: 8.3.1 +version: 8.3.2 description: Code generators for Angel3 ORM. Generates query builder classes. homepage: https://angel3-framework.web.app/ repository: https://github.com/dart-backend/angel/tree/master/packages/orm/angel_orm_generator diff --git a/packages/orm/angel_orm_postgres/CHANGELOG.md b/packages/orm/angel_orm_postgres/CHANGELOG.md index 2fc065eb..1f16e755 100644 --- a/packages/orm/angel_orm_postgres/CHANGELOG.md +++ b/packages/orm/angel_orm_postgres/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 8.2.2 + +* Fixed analyzer warnings + ## 8.2.1 * Updated dependencies diff --git a/packages/orm/angel_orm_postgres/README.md b/packages/orm/angel_orm_postgres/README.md index 11f27dee..fa1a8a87 100644 --- a/packages/orm/angel_orm_postgres/README.md +++ b/packages/orm/angel_orm_postgres/README.md @@ -15,4 +15,6 @@ For documentation about the ORM, see [Developer Guide](https://angel3-docs.dukef ## Migration -Posrgresql is upgraded from 2.x.x to 3.x.x in version 8.1.0. +### From version 7.x to 8.1.x + +`postgres` has been upgraded from 2.x.x to 3.x.x since version 8.1.0. This is a breaking change as `postgres` 3.x.x has majorly changed its API. Therefore when upgrading to 8.1.0 and beyond, the PostgreSQL connection settings need to be migrated. The rest should remain the same. Please see the example for the new PostgreSQL connection settings. diff --git a/packages/orm/angel_orm_postgres/lib/src/orm_postgres.dart b/packages/orm/angel_orm_postgres/lib/src/orm_postgres.dart index 6708b657..60480b4f 100644 --- a/packages/orm/angel_orm_postgres/lib/src/orm_postgres.dart +++ b/packages/orm/angel_orm_postgres/lib/src/orm_postgres.dart @@ -105,14 +105,12 @@ class PostgreSqlExecutor extends QueryExecutor { var conn = _session as Connection; - return await conn.runTx((session) async { + return await conn.runTx((TxSession session) async { try { - //logger.fine('Entering transaction'); var exec = PostgreSqlExecutor(session, logger: logger); return await f(exec); } catch (e) { session.rollback(); - //ctx.cancelTransaction(reason: e.toString()); logger.warning("The transation has failed due to ", e); rethrow; } diff --git a/packages/orm/angel_orm_postgres/lib/src/orm_postgres_pool.dart b/packages/orm/angel_orm_postgres/lib/src/orm_postgres_pool.dart index 59278daf..7befeb5b 100644 --- a/packages/orm/angel_orm_postgres/lib/src/orm_postgres_pool.dart +++ b/packages/orm/angel_orm_postgres/lib/src/orm_postgres_pool.dart @@ -54,7 +54,7 @@ class PostgreSqlPoolExecutor extends QueryExecutor { } }); - return _pool.run((session) async { + return _pool.run((Session session) async { return await session.execute(Sql.named(query), parameters: param); }); } diff --git a/packages/orm/angel_orm_postgres/pubspec.yaml b/packages/orm/angel_orm_postgres/pubspec.yaml index afc067e9..98b8cfde 100644 --- a/packages/orm/angel_orm_postgres/pubspec.yaml +++ b/packages/orm/angel_orm_postgres/pubspec.yaml @@ -1,5 +1,5 @@ name: angel3_orm_postgres -version: 8.2.1 +version: 8.2.2 description: PostgreSQL support for Angel3 ORM. Includes functionality for querying and transactions. homepage: https://angel3-framework.web.app/ repository: https://github.com/dart-backend/angel/tree/master/packages/orm/angel_orm_postgres @@ -9,7 +9,7 @@ dependencies: angel3_orm: ^8.2.0 logging: ^1.2.0 pool: ^1.5.0 - postgres: ^3.0.0 + postgres: ^3.2.0 dev_dependencies: belatuk_pretty_logging: ^6.1.0 angel3_orm_generator: ^8.2.0 diff --git a/packages/orm/angel_orm_service/CHANGELOG.md b/packages/orm/angel_orm_service/CHANGELOG.md index c50c1c63..5974ebce 100644 --- a/packages/orm/angel_orm_service/CHANGELOG.md +++ b/packages/orm/angel_orm_service/CHANGELOG.md @@ -8,7 +8,7 @@ ## 8.2.1 * Updated dependencies -* Updated `popstgres` to 3.0.0 +* [BREAKING] Updated `postgres` to 3.2.0 ## 8.2.0 diff --git a/packages/orm/angel_orm_service/pubspec.yaml b/packages/orm/angel_orm_service/pubspec.yaml index 688fc070..88e5a313 100644 --- a/packages/orm/angel_orm_service/pubspec.yaml +++ b/packages/orm/angel_orm_service/pubspec.yaml @@ -8,7 +8,7 @@ environment: dependencies: angel3_framework: ^8.4.0 angel3_orm: ^8.2.0 - postgres: ^3.0.0 + postgres: ^3.2.0 optional: ^6.0.0 dev_dependencies: angel3_migration: ^8.2.0 diff --git a/packages/orm/angel_orm_test/CHANGELOG.md b/packages/orm/angel_orm_test/CHANGELOG.md index 36610242..f8d75b1f 100644 --- a/packages/orm/angel_orm_test/CHANGELOG.md +++ b/packages/orm/angel_orm_test/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 8.2.1 + +* Fixed analyzer warnings + ## 8.2.0 * Require Dart >= 3.3 diff --git a/packages/orm/angel_orm_test/lib/src/many_to_many_test.dart b/packages/orm/angel_orm_test/lib/src/many_to_many_test.dart index 04a138c9..eeb6f405 100644 --- a/packages/orm/angel_orm_test/lib/src/many_to_many_test.dart +++ b/packages/orm/angel_orm_test/lib/src/many_to_many_test.dart @@ -1,5 +1,4 @@ import 'dart:async'; -import 'dart:io'; import 'package:angel3_orm/angel3_orm.dart'; import 'package:test/test.dart'; import 'models/user.dart'; @@ -12,6 +11,7 @@ void manyToManyTests(FutureOr Function() createExecutor, User? thosakwe; close ??= (_) => null; + /* Future dumpQuery(String query) async { if (Platform.environment.containsKey('STFU')) return; print('\n'); @@ -26,28 +26,11 @@ void manyToManyTests(FutureOr Function() createExecutor, } print('==================================================\n\n'); } + */ setUp(() async { executor = await createExecutor(); -// await dumpQuery(""" -// WITH roles as -// (INSERT INTO roles (name) -// VALUES ('pyt') -// RETURNING roles.id, roles.name, roles.created_at, roles.updated_at) -// SELECT -// roles.id, roles.name, roles.created_at, roles.updated_at -// FROM roles -// LEFT JOIN -// (SELECT -// role_users.role_id, role_users.user_id, -// a0.id, a0.username, a0.password, a0.email, a0.created_at, a0.updated_at -// FROM role_users -// LEFT JOIN -// users a0 ON role_users.user_id=a0.id) -// a1 ON roles.id=a1.role_id -// """); - var canPubQuery = RoleQuery()..values.name = 'can_pub'; var canSubQuery = RoleQuery()..values.name = 'can_sub'; canPub = (await canPubQuery.insert(executor)).value; diff --git a/packages/orm/angel_orm_test/pubspec.yaml b/packages/orm/angel_orm_test/pubspec.yaml index d874a98c..57f3c80f 100644 --- a/packages/orm/angel_orm_test/pubspec.yaml +++ b/packages/orm/angel_orm_test/pubspec.yaml @@ -1,22 +1,22 @@ name: angel3_orm_test -version: 8.2.0 +version: 8.2.1 description: Common tests for Angel3 ORM. Reference implmentation of the generated ORM files. homepage: https://angel3-framework.web.app/ repository: https://github.com/dart-backend/angel/tree/master/packages/orm/angel_orm_test environment: sdk: '>=3.3.0 <4.0.0' dependencies: - angel3_migration: ^8.0.0 - angel3_model: ^8.0.0 - angel3_orm: ^8.0.0 - angel3_serialize: ^8.0.0 + angel3_migration: ^8.2.0 + angel3_model: ^8.2.0 + angel3_orm: ^8.2.0 + angel3_serialize: ^8.2.0 io: ^1.0.0 test: ^1.24.0 collection: ^1.17.0 optional: ^6.1.0 dev_dependencies: - angel3_orm_generator: ^8.0.0 - angel3_framework: ^8.0.0 + angel3_orm_generator: ^8.3.0 + angel3_framework: ^8.4.0 build_runner: ^2.4.0 lints: ^4.0.0 #dependency_overrides: