From 1c4ff192a5d0830bcaceace409d63d676bdf8c7f Mon Sep 17 00:00:00 2001 From: "thomashii@dukefirehawk.com" Date: Tue, 4 May 2021 16:53:32 +0800 Subject: [PATCH] Migrated angel_orm --- CHANGELOG.md | 6 +++--- packages/orm/angel_orm_generator/example/main.dart | 2 +- .../orm/angel_orm_generator/example/main.g.dart | 14 +++++++------- packages/orm/angel_orm_postgres/example/main.dart | 5 +++-- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99c8b69f..dcf38b1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,7 +37,7 @@ * Migrated angel_orm_generator to 4.0.0 (0/0 tests passed) * Migrated angel_migration_runner to 3.0.0 (0/0 tests passed) * Migrated angel_orm_test to 3.0.0 (0/0 tests passed) -* Migrated angel_orm_postgres to 3.0.0 (0/0 tests passed) +* Migrated angel_orm_postgres to 3.0.0 (21/54 tests passed) * Update orm-sdk-2.12.x boilerplate (in progress) <= Milestone 2 @@ -71,8 +71,8 @@ * Updated angel_migration to 3.0.0 (0/0 tests passed) * Updated angel_orm_generator to 3.0.0 (0/0 tests passed, use a fork of postgres) * Updated angel_migration_runner to 3.0.0 (0/0 tests passed) -* Updated angel_orm_test to 1.0.0 -* Updated angel_orm_postgres to 2.0.0 +* Updated angel_orm_test to 1.0.0 (0/0 tests passed) +* Updated angel_orm_postgres to 2.0.0 (52/54 tests passed) * Update orm-sdk-2.12.x boilerplate * Updated angel_auth_oauth2 to 3.0.0 * Updated angel_auth_cache to 3.0.0 diff --git a/packages/orm/angel_orm_generator/example/main.dart b/packages/orm/angel_orm_generator/example/main.dart index 84421f81..321794ac 100644 --- a/packages/orm/angel_orm_generator/example/main.dart +++ b/packages/orm/angel_orm_generator/example/main.dart @@ -6,7 +6,7 @@ import 'package:angel_orm/src/query.dart'; import 'package:angel_serialize/angel_serialize.dart'; part 'main.g.dart'; -main() async { +void main() async { var query = EmployeeQuery() ..where!.firstName.equals('Rich') ..where!.lastName.equals('Person') diff --git a/packages/orm/angel_orm_generator/example/main.g.dart b/packages/orm/angel_orm_generator/example/main.g.dart index 78717b64..b5cb3b47 100644 --- a/packages/orm/angel_orm_generator/example/main.g.dart +++ b/packages/orm/angel_orm_generator/example/main.g.dart @@ -32,7 +32,7 @@ class EmployeeMigration extends Migration { class EmployeeQuery extends Query { EmployeeQuery({Set? trampoline}) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = EmployeeQueryWhere(this); } @@ -43,17 +43,17 @@ class EmployeeQuery extends Query { EmployeeQueryWhere? _where; @override - get casts { + Map get casts { return {'salary': 'text'}; } @override - get tableName { + String get tableName { return 'employees'; } @override - get fields { + List get fields { return const [ 'id', 'created_at', @@ -89,7 +89,7 @@ class EmployeeQuery extends Query { } @override - deserialize(List row) { + Employee? deserialize(List row) { return parseRow(row); } } @@ -119,7 +119,7 @@ class EmployeeQueryWhere extends QueryWhere { final NumericSqlExpressionBuilder salary; @override - get expressionBuilders { + List get expressionBuilders { return [id, createdAt, updatedAt, uniqueId, firstName, lastName, salary]; } } @@ -252,7 +252,7 @@ class Employee extends _Employee { @override String toString() { - return "Employee(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, uniqueId=$uniqueId, firstName=$firstName, lastName=$lastName, salary=$salary)"; + return 'Employee(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, uniqueId=$uniqueId, firstName=$firstName, lastName=$lastName, salary=$salary)'; } Map toJson() { diff --git a/packages/orm/angel_orm_postgres/example/main.dart b/packages/orm/angel_orm_postgres/example/main.dart index ad376f1d..296b2362 100644 --- a/packages/orm/angel_orm_postgres/example/main.dart +++ b/packages/orm/angel_orm_postgres/example/main.dart @@ -3,8 +3,9 @@ import 'package:angel_orm_postgres/angel_orm_postgres.dart'; import 'package:postgres/postgres.dart'; main() async { - var executor = new PostgreSqlExecutorPool(Platform.numberOfProcessors, () { - return new PostgreSQLConnection('localhost', 5432, 'angel_orm_test'); + var executor = PostgreSqlExecutorPool(Platform.numberOfProcessors, () { + return PostgreSQLConnection('localhost', 5432, 'orm_test', + username: 'test', password: 'test123'); }); var rows = await executor.query('users', 'SELECT * FROM users', {});