Skip to content

Commit

Permalink
fix: RAW parameter decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
Seven Du committed May 23, 2023
1 parent aca4550 commit cba5e9e
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lib/src/client/prisma_raw_codec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class PrismaTypedParameter {
if (json.containsKey('prisma__type') && json.containsKey('prisma__value')) {
return PrismaTypedParameter.fromJson(json);
}

return null;
}

Expand All @@ -55,8 +56,9 @@ class PrismaTypedParameter {
if (value == null) {
return null;
} else if (value is DateTime) {
return value.toIso8601String();
return value.toUtc().toIso8601String();
}

return value.toString();
}
}
Expand Down Expand Up @@ -122,16 +124,12 @@ class PrismaRawParameterDecoder extends Converter<Object?, Object?> {

/// Decode a JSON compatible value to a parameter.
Object? _decodeParameter(String type, String? value) {
if (value == null) {
return null;
}
if (value == null) return null;

type = type.toLowerCase().trim();
final parse = _typedParameterParsers[type];
if (parse != null) {
return parse(value);
}

return value;
return parse == null ? value : parse(value);
}

/// Typed parameter to parses.
Expand Down

1 comment on commit cba5e9e

@vercel
Copy link

@vercel vercel bot commented on cba5e9e May 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.