Updated angel_orm

This commit is contained in:
thomashii 2021-07-19 12:27:40 +08:00
parent 0f15b1932a
commit cd5c120f8f
4 changed files with 102 additions and 55 deletions

View file

@ -1,24 +1,38 @@
# 4.0.0-beta.2 # Change Log
## 4.0.0-beta.3
* Updated README
* Fixed NNBD issues
## 4.0.0-beta.2
* Fixed static analysis warning * Fixed static analysis warning
# 4.0.0-beta.1 ## 4.0.0-beta.1
* Migrated to support Dart SDK 2.12.x NNBD * Migrated to support Dart SDK 2.12.x NNBD
# 3.0.0 ## 3.0.0
* Migrated to work with Dart SDK 2.12.x Non NNBD * Migrated to work with Dart SDK 2.12.x Non NNBD
# 2.1.0-beta.3 ## 2.1.0-beta.3
* Remove parentheses from `AS` when renaming raw `expressions`. * Remove parentheses from `AS` when renaming raw `expressions`.
# 2.1.0-beta.2 ## 2.1.0-beta.2
* Add `expressions` to `Query`, to support custom SQL expressions that are * Add `expressions` to `Query`, to support custom SQL expressions that are
read as normal fields. read as normal fields.
# 2.1.0-beta.1 ## 2.1.0-beta.1
* Calls to `leftJoin`, etc. alias all fields in a child query, to prevent * Calls to `leftJoin`, etc. alias all fields in a child query, to prevent
`ambiguous column a0.id` errors. `ambiguous column a0.id` errors.
# 2.1.0-beta ## 2.1.0-beta
* Split the formerly 600+ line `src/query.dart` up into * Split the formerly 600+ line `src/query.dart` up into
separate files. separate files.
* **BREAKING**: Add a required `QueryExecutor` argument to `transaction` * **BREAKING**: Add a required `QueryExecutor` argument to `transaction`
@ -30,126 +44,159 @@ ORM queries to reference their joined subqueries.
* `and`, `or`, `not` in `QueryWhere` include parentheses. * `and`, `or`, `not` in `QueryWhere` include parentheses.
* Add `joinType` to `Relationship` class. * Add `joinType` to `Relationship` class.
# 2.0.2 ## 2.0.2
* Place `LIMIT` and `OFFSET` after `ORDER BY`. * Place `LIMIT` and `OFFSET` after `ORDER BY`.
# 2.0.1 ## 2.0.1
* Apply `package:pedantic` fixes. * Apply `package:pedantic` fixes.
* `@PrimaryKey()` no longer defaults to `serial`, allowing its type to be * `@PrimaryKey()` no longer defaults to `serial`, allowing its type to be
inferenced. inferenced.
# 2.0.0 ## 2.0.0
* Add `isNull`, `isNotNull` getters to builders. * Add `isNull`, `isNotNull` getters to builders.
# 2.0.0-dev.24 ## 2.0.0-dev.24
* Fix a bug that caused syntax errors on `ORDER BY`. * Fix a bug that caused syntax errors on `ORDER BY`.
* Add `pattern` to `like` on string builder. `sanitize` is optional. * Add `pattern` to `like` on string builder. `sanitize` is optional.
* Add `RawSql`. * Add `RawSql`.
# 2.0.0-dev.23 ## 2.0.0-dev.23
* Add `@ManyToMany` annotation, which builds many-to-many relations. * Add `@ManyToMany` annotation, which builds many-to-many relations.
# 2.0.0-dev.22 ## 2.0.0-dev.22
* `compileInsert` will explicitly never emit a key not belonging to the * `compileInsert` will explicitly never emit a key not belonging to the
associated query. associated query.
# 2.0.0-dev.21 ## 2.0.0-dev.21
* Add tableName to query * Add tableName to query
# 2.0.0-dev.20 ## 2.0.0-dev.20
* Join updates. * Join updates.
# 2.0.0-dev.19 ## 2.0.0-dev.19
* Implement cast-based `double` support. * Implement cast-based `double` support.
* Finish `ListSqlExpressionBuilder`. * Finish `ListSqlExpressionBuilder`.
# 2.0.0-dev.18 ## 2.0.0-dev.18
* Add `ListSqlExpressionBuilder` (still in development). * Add `ListSqlExpressionBuilder` (still in development).
# 2.0.0-dev.17 ## 2.0.0-dev.17
* Add `EnumSqlExpressionBuilder`. * Add `EnumSqlExpressionBuilder`.
# 2.0.0-dev.16 ## 2.0.0-dev.16
* Add `MapSqlExpressionBuilder` for JSON/JSONB support. * Add `MapSqlExpressionBuilder` for JSON/JSONB support.
# 2.0.0-dev.15 ## 2.0.0-dev.15
* Remove `Column.defaultValue`. * Remove `Column.defaultValue`.
* Deprecate `toSql` and `sanitizeExpression`. * Deprecate `toSql` and `sanitizeExpression`.
* Refactor builders so that strings are passed through * Refactor builders so that strings are passed through
# 2.0.0-dev.14 ## 2.0.0-dev.14
* Remove obsolete `@belongsToMany`. * Remove obsolete `@belongsToMany`.
# 2.0.0-dev.13 ## 2.0.0-dev.13
* Push for consistency with orm_gen @ `2.0.0-dev`. * Push for consistency with orm_gen @ `2.0.0-dev`.
# 2.0.0-dev.12 ## 2.0.0-dev.12
* Always apply `toSql` escapes. * Always apply `toSql` escapes.
# 2.0.0-dev.11 ## 2.0.0-dev.11
* Remove `limit(1)` except on `getOne` * Remove `limit(1)` except on `getOne`
# 2.0.0-dev.10 ## 2.0.0-dev.10
* Add `withFields` to `compile()` * Add `withFields` to `compile()`
# 2.0.0-dev.9 ## 2.0.0-dev.9
* Permanent preamble fix * Permanent preamble fix
# 2.0.0-dev.8 ## 2.0.0-dev.8
* Escapes * Escapes
# 2.0.0-dev.7 ## 2.0.0-dev.7
* Update `toSql` * Update `toSql`
* Add `isTrue` and `isFalse` * Add `isTrue` and `isFalse`
# 2.0.0-dev.6 ## 2.0.0-dev.6
* Add `delete`, `insert` and `update` methods to `Query`. * Add `delete`, `insert` and `update` methods to `Query`.
# 2.0.0-dev.4 ## 2.0.0-dev.4
* Add more querying methods. * Add more querying methods.
* Add preamble to `Query.compile`. * Add preamble to `Query.compile`.
# 2.0.0-dev.3 ## 2.0.0-dev.3
* Brought back old-style query builder. * Brought back old-style query builder.
* Strong-mode updates, revised `Join`. * Strong-mode updates, revised `Join`.
# 2.0.0-dev.2 ## 2.0.0-dev.2
* Renamed `ORM` to `Orm`. * Renamed `ORM` to `Orm`.
* `Orm` now requires a database type. * `Orm` now requires a database type.
# 2.0.0-dev.1 ## 2.0.0-dev.1
* Restored all old PostgreSQL-specific annotations. Rather than a smart runtime, * Restored all old PostgreSQL-specific annotations. Rather than a smart runtime,
having a codegen capable of building ORM's for multiple databases can potentially having a codegen capable of building ORM's for multiple databases can potentially
provide a very fast ORM for everyone. provide a very fast ORM for everyone.
# 2.0.0-dev ## 2.0.0-dev
* Removed PostgreSQL-specific functionality, so that the ORM can ultimately * Removed PostgreSQL-specific functionality, so that the ORM can ultimately
target all services. target all services.
* Created a better `Join` model. * Created a better `Join` model.
* Created a far better `Query` model. * Created a far better `Query` model.
* Removed `lib/server.dart` * Removed `lib/server.dart`
# 1.0.0-alpha+10 ## 1.0.0-alpha+10
* Split into `angel_orm.dart` and `server.dart`. Prevents DDC failures. * Split into `angel_orm.dart` and `server.dart`. Prevents DDC failures.
# 1.0.0-alpha+7 ## 1.0.0-alpha+7
* Added a `@belongsToMany` annotation class. * Added a `@belongsToMany` annotation class.
* Resolved [#20](https://github.com/angel-dart/orm/issues/20). The * Resolved [##20](https://github.com/angel-dart/orm/issues/20). The
`PostgreSQLConnectionPool` keeps track of which connections have been opened now. `PostgreSQLConnectionPool` keeps track of which connections have been opened now.
# 1.0.0-alpha+6 ## 1.0.0-alpha+6
* `DateTimeSqlExpressionBuilder` will no longer automatically * `DateTimeSqlExpressionBuilder` will no longer automatically
insert quotation marks around names. insert quotation marks around names.
# 1.0.0-alpha+5 ## 1.0.0-alpha+5
* Corrected a typo that was causing the aforementioned test failures. * Corrected a typo that was causing the aforementioned test failures.
`==` becomes `=`. `==` becomes `=`.
# 1.0.0-alpha+4 ## 1.0.0-alpha+4
* Added a null-check in `lib/src/query.dart#L24` to (hopefully) prevent it from
* Added a null-check in `lib/src/query.dart##L24` to (hopefully) prevent it from
crashing on Travis. crashing on Travis.
# 1.0.0-alpha+3 ## 1.0.0-alpha+3
* Added `isIn`, `isNotIn`, `isBetween`, `isNotBetween` to `SqlExpressionBuilder` and its * Added `isIn`, `isNotIn`, `isBetween`, `isNotBetween` to `SqlExpressionBuilder` and its
subclasses. subclasses.
* Added a dependency on `package:meta`. * Added a dependency on `package:meta`.

View file

@ -1,12 +1,11 @@
# angel3_orm # Angel3 ORM
[![version](https://img.shields.io/badge/pub-v4.0.0-brightgreen)](https://pub.dartlang.org/packages/angel3_orm) [![version](https://img.shields.io/badge/pub-v4.0.0-brightgreen)](https://pub.dartlang.org/packages/angel3_orm)
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![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) [![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/LICENSE) [![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/angel3/packages/orm/angel_orm/LICENSE)
Runtime support for Angel's ORM. Includes a clean, database-agnostic Runtime support for Angel3 ORM. Includes a clean, database-agnostic query builder and relationship/join support.
query builder and relationship/join support.
For documentation about the ORM, head to the main project repo: For documentation about the ORM, see [Developer Guide](https://angel3-docs.dukefirehawk.com/guides/orm)
https://github.com/angel-dart/orm

View file

@ -18,10 +18,10 @@ class Column {
final bool isNullable; final bool isNullable;
/// Specifies the length of a `VARCHAR`. /// Specifies the length of a `VARCHAR`.
final int? length; final int length;
/// Explicitly defines a SQL type for this column. /// Explicitly defines a SQL type for this column.
final ColumnType? type; final ColumnType type;
/// Specifies what kind of index this column is, if any. /// Specifies what kind of index this column is, if any.
final IndexType indexType; final IndexType indexType;
@ -31,8 +31,8 @@ class Column {
const Column( const Column(
{this.isNullable = true, {this.isNullable = true,
this.length, this.length = 256,
this.type, this.type = ColumnType.varChar,
this.indexType = IndexType.none, this.indexType = IndexType.none,
this.expression}); this.expression});
@ -41,7 +41,7 @@ class Column {
} }
class PrimaryKey extends Column { class PrimaryKey extends Column {
const PrimaryKey({ColumnType? columnType}) const PrimaryKey({ColumnType columnType = ColumnType.varChar})
: super(type: columnType, indexType: IndexType.primaryKey); : super(type: columnType, indexType: IndexType.primaryKey);
} }

View file

@ -1,7 +1,8 @@
name: angel3_orm name: angel3_orm
version: 4.0.0-beta.2 version: 4.0.0-beta.3
description: Runtime support for Angel's ORM. Includes base classes for queries. description: Runtime support for Angel3 ORM. Includes base classes for queries.
homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/orm/angel_orm homepage: https://angel3-framework.web.app/
repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/orm/angel_orm
environment: environment:
sdk: '>=2.12.0 <3.0.0' sdk: '>=2.12.0 <3.0.0'
dependencies: dependencies: