Migrated angel_orm

This commit is contained in:
thomashii@dukefirehawk.com 2021-05-04 16:53:32 +08:00
parent 8d3c8b9121
commit 1c4ff192a5
4 changed files with 14 additions and 13 deletions

View file

@ -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

View file

@ -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')

View file

@ -32,7 +32,7 @@ class EmployeeMigration extends Migration {
class EmployeeQuery extends Query<Employee?, EmployeeQueryWhere?> {
EmployeeQuery({Set<String>? trampoline}) {
trampoline ??= Set();
trampoline ??= {};
trampoline.add(tableName);
_where = EmployeeQueryWhere(this);
}
@ -43,17 +43,17 @@ class EmployeeQuery extends Query<Employee?, EmployeeQueryWhere?> {
EmployeeQueryWhere? _where;
@override
get casts {
Map<String, String> get casts {
return {'salary': 'text'};
}
@override
get tableName {
String get tableName {
return 'employees';
}
@override
get fields {
List<String> get fields {
return const [
'id',
'created_at',
@ -89,7 +89,7 @@ class EmployeeQuery extends Query<Employee?, EmployeeQueryWhere?> {
}
@override
deserialize(List row) {
Employee? deserialize(List row) {
return parseRow(row);
}
}
@ -119,7 +119,7 @@ class EmployeeQueryWhere extends QueryWhere {
final NumericSqlExpressionBuilder<double> salary;
@override
get expressionBuilders {
List<SqlExpressionBuilder> 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<String, dynamic> toJson() {

View file

@ -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', {});