Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.7.1 #86

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.7.1

- `DBPostgreSQLAdapter`:
- Fix `_parseConstraint` for enums with single values.

## 1.7.0

- `ConditionParameter`:
Expand Down
2 changes: 1 addition & 1 deletion lib/src/bones_api_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ typedef APILogger = void Function(APIRoot apiRoot, String type, String? message,
/// Bones API Library class.
class BonesAPI {
// ignore: constant_identifier_names
static const String VERSION = '1.7.0';
static const String VERSION = '1.7.1';

static bool _boot = false;

Expand Down
23 changes: 16 additions & 7 deletions lib/src/bones_api_entity_db_postgres.dart
Original file line number Diff line number Diff line change
Expand Up @@ -545,15 +545,24 @@

var arrayDef = RegExp(r'ARRAY\[(.*?)]').firstMatch(s)?.group(1)?.trim();

if (arrayDef == null || arrayDef.isEmpty) return null;
Set<String>? values;

if (arrayDef != null && arrayDef.isNotEmpty) {
values = RegExp(r"'(.*?)'")
.allMatches(arrayDef)
.map((m) => m.group(1))
.whereNotNull()
.toSet();
} else {
var singleValue =
RegExp(r"\s+=\s+'(.*?)'").firstMatch(s)?.group(1)?.trim();

Check warning on line 558 in lib/src/bones_api_entity_db_postgres.dart

View check run for this annotation

Codecov / codecov/patch

lib/src/bones_api_entity_db_postgres.dart#L558

Added line #L558 was not covered by tests

var values = RegExp(r"'(.*?)'")
.allMatches(arrayDef)
.map((m) => m.group(1))
.whereNotNull()
.toSet();
if (singleValue != null) {
values = {singleValue};

Check warning on line 561 in lib/src/bones_api_entity_db_postgres.dart

View check run for this annotation

Codecov / codecov/patch

lib/src/bones_api_entity_db_postgres.dart#L561

Added line #L561 was not covered by tests
}
}

if (values.isEmpty) return null;
if (values == null || values.isEmpty) return null;

return TableEnumConstraint(field, values);
}
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: bones_api
description: Bones_API - A powerful API backend framework for Dart. It comes with a built-in HTTP Server, route handler, entity handler, SQL translator, and DB adapters.
version: 1.7.0
version: 1.7.1
homepage: https://github.com/Colossus-Services/bones_api

environment:
Expand All @@ -11,7 +11,7 @@ executables:

dependencies:
async_extension: ^1.2.12
async_events: ^1.1.0
async_events: ^1.2.0
reflection_factory: ^2.3.4
statistics: ^1.1.0
swiss_knife: ^3.2.0
Expand Down Expand Up @@ -54,7 +54,7 @@ dev_dependencies:
lints: ^3.0.0
build_runner: ^2.4.9
build_verify: ^3.1.0
test: ^1.25.3
test: ^1.25.4
pubspec: ^2.3.0
dependency_validator: ^3.2.3
coverage: ^1.7.2
Expand Down
Loading