Published orm_service
This commit is contained in:
parent
4141c60c50
commit
bba3948a2b
10 changed files with 43 additions and 69 deletions
|
@ -1,4 +1,4 @@
|
||||||
# 2.0.0
|
# 2.0.0-beta.1
|
||||||
* Migrated to support Dart SDK 2.12.x NNBD
|
* Migrated to support Dart SDK 2.12.x NNBD
|
||||||
|
|
||||||
# 1.0.0
|
# 1.0.0
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
# angel_orm_service
|
# angel3_orm_service
|
||||||
[![Pub](https://img.shields.io/pub/v/angel_orm_service.svg)](https://pub.dartlang.org/packages/angel_orm_service)
|
[![version](https://img.shields.io/badge/pub-v2.0.0-brightgreen)](https://pub.dartlang.org/packages/angel3_orm_service)
|
||||||
[![build status](https://travis-ci.org/angel-dart/orm.svg)](https://travis-ci.org/angel-dart/orm)
|
[![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.
|
Service implementation that wraps over Angel ORM Query classes.
|
||||||
|
|
||||||
|
@ -9,7 +12,7 @@ In your `pubspec.yaml`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
dependencies:
|
dependencies:
|
||||||
angel_orm_service: ^1.0.0
|
angel3_orm_service: ^2.0.0-beta.1
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
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';
|
import 'package:postgres/postgres.dart';
|
||||||
|
|
||||||
final conn = PostgreSQLConnection('localhost', 5432, 'angel_orm_service_test',
|
final conn = PostgreSQLConnection('localhost', 5432, 'angel_orm_service_test',
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
import 'package:angel_framework/http.dart';
|
import 'package:angel3_framework/http.dart';
|
||||||
import 'package:angel_orm_service/angel_orm_service.dart';
|
import 'package:angel3_orm_service/angel3_orm_service.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'connect.dart';
|
import 'connect.dart';
|
||||||
import 'todo.dart';
|
import 'todo.dart';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import 'package:angel_migration_runner/angel_migration_runner.dart';
|
import 'package:angel3_migration_runner/angel3_migration_runner.dart';
|
||||||
import 'package:angel_migration_runner/postgres.dart';
|
import 'package:angel3_migration_runner/postgres.dart';
|
||||||
import 'connect.dart';
|
import 'connect.dart';
|
||||||
import 'todo.dart';
|
import 'todo.dart';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import 'package:angel_migration/angel_migration.dart';
|
import 'package:angel3_migration/angel3_migration.dart';
|
||||||
import 'package:angel_serialize/angel_serialize.dart';
|
import 'package:angel3_serialize/angel3_serialize.dart';
|
||||||
import 'package:angel_orm/angel_orm.dart';
|
import 'package:angel3_orm/angel3_orm.dart';
|
||||||
import 'package:optional/optional.dart';
|
import 'package:optional/optional.dart';
|
||||||
part 'todo.g.dart';
|
part 'todo.g.dart';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:angel_framework/angel_framework.dart' hide Query;
|
import 'package:angel3_framework/angel3_framework.dart' hide Query;
|
||||||
import 'package:angel_orm/angel_orm.dart';
|
import 'package:angel3_orm/angel3_orm.dart';
|
||||||
|
|
||||||
/// A [Service] implementation that wraps over a [Query] class generated
|
/// A [Service] implementation that wraps over a [Query] class generated
|
||||||
/// via the Angel ORM.
|
/// via the Angel ORM.
|
||||||
|
@ -40,7 +40,7 @@ class OrmService<Id, Data, TQuery extends Query<Data, QueryWhere>>
|
||||||
return query.where!.expressionBuilders.firstWhere(
|
return query.where!.expressionBuilders.firstWhere(
|
||||||
(b) => b.columnName == name,
|
(b) => b.columnName == name,
|
||||||
orElse: (() => throw ArgumentError(
|
orElse: (() => throw ArgumentError(
|
||||||
'${query.where.runtimeType} has no expression builder for a column named "$name".')) as SqlExpressionBuilder<dynamic> Function()?);
|
'${query.where.runtimeType} has no expression builder for a column named "$name".')));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _apply(TQuery query, String name, dynamic value) {
|
void _apply(TQuery query, String name, dynamic value) {
|
||||||
|
@ -119,7 +119,7 @@ class OrmService<Id, Data, TQuery extends Query<Data, QueryWhere>>
|
||||||
_apply(query, idField, id);
|
_apply(query, idField, id);
|
||||||
await _applyQuery(query, params);
|
await _applyQuery(query, params);
|
||||||
var result = await query.getOne(executor);
|
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');
|
throw AngelHttpException.notFound(message: 'No record found for ID $id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ class OrmService<Id, Data, TQuery extends Query<Data, QueryWhere>>
|
||||||
var query = await queryCreator();
|
var query = await queryCreator();
|
||||||
await _applyQuery(query, params);
|
await _applyQuery(query, params);
|
||||||
var result = await query.getOne(executor);
|
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);
|
throw AngelHttpException.notFound(message: errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ class OrmService<Id, Data, TQuery extends Query<Data, QueryWhere>>
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = await query.updateOne(executor);
|
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');
|
throw AngelHttpException.notFound(message: 'No record found for ID $id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ class OrmService<Id, Data, TQuery extends Query<Data, QueryWhere>>
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = await query.deleteOne(executor);
|
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');
|
throw AngelHttpException.notFound(message: 'No record found for ID $id');
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,54 +1,25 @@
|
||||||
name: angel_orm_service
|
name: angel3_orm_service
|
||||||
version: 2.0.0
|
version: 2.0.0-beta.1
|
||||||
description: Service implementation that wraps over Angel ORM Query classes.
|
description: Service implementation that wraps over Angel3 ORM Query classes.
|
||||||
homepage: https://github.com/angel-dart/orm
|
homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/orm/angel_orm_service
|
||||||
publish_to: none
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
dependencies:
|
dependencies:
|
||||||
angel_framework:
|
angel3_framework: ^4.0.0
|
||||||
git:
|
angel3_orm: ^4.0.0-beta.1
|
||||||
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
|
|
||||||
postgres: ^2.3.2
|
postgres: ^2.3.2
|
||||||
optional: ^6.0.0-nullsafety.2
|
optional: ^6.0.0-nullsafety.2
|
||||||
dev_dependencies:
|
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:
|
git:
|
||||||
url: https://github.com/dukefirehawk/angel.git
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
ref: sdk-2.12.x_nnbd
|
ref: angel3
|
||||||
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
|
|
||||||
path: packages/orm/angel_orm_test
|
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
|
build_runner: ^2.0.4
|
||||||
logging: ^1.0.1
|
logging: ^1.0.1
|
||||||
pedantic: ^1.11.0
|
pedantic: ^1.11.0
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
import 'package:angel_orm_postgres/angel_orm_postgres.dart';
|
import 'package:angel3_orm_postgres/angel3_orm_postgres.dart';
|
||||||
import 'package:angel_orm_service/angel_orm_service.dart';
|
import 'package:angel3_orm_service/angel3_orm_service.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:postgres/postgres.dart';
|
import 'package:postgres/postgres.dart';
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import 'package:angel_migration/angel_migration.dart';
|
import 'package:angel3_migration/angel3_migration.dart';
|
||||||
import 'package:angel_serialize/angel_serialize.dart';
|
import 'package:angel3_serialize/angel3_serialize.dart';
|
||||||
import 'package:angel_orm/angel_orm.dart';
|
import 'package:angel3_orm/angel3_orm.dart';
|
||||||
import 'package:optional/optional.dart';
|
import 'package:optional/optional.dart';
|
||||||
part 'pokemon.g.dart';
|
part 'pokemon.g.dart';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue