diff --git a/src/YuckQi.Data.DocumentDb.DynamoDb/Extensions/FilterCriteriaExtensions.cs b/src/YuckQi.Data.DocumentDb.DynamoDb/Extensions/FilterCriteriaExtensions.cs index e7c320f..f4c0514 100644 --- a/src/YuckQi.Data.DocumentDb.DynamoDb/Extensions/FilterCriteriaExtensions.cs +++ b/src/YuckQi.Data.DocumentDb.DynamoDb/Extensions/FilterCriteriaExtensions.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using Amazon.DynamoDBv2.DocumentModel; +using Amazon.DynamoDBv2.DocumentModel; using Amazon.DynamoDBv2.Model; using YuckQi.Data.Filtering; @@ -14,15 +13,53 @@ public static QueryFilter ToQueryFilter(this IReadOnlyCollection foreach (var parameter in parameters) { var attribute = parameter.FieldName; - var comparison = parameter.Operation.ToComparisonOperator(); - var value = new AttributeValue(parameter.Value?.ToString()); - var condition = new Condition - { - AttributeValueList = new List { value }, - ComparisonOperator = comparison - }; + var comparison = parameter.Operation.ToQueryOperator(); - filter.AddCondition(attribute, condition); + switch (parameter.Value) + { + case Boolean value: + filter.AddCondition(attribute, comparison, value); + break; + case Char value: + filter.AddCondition(attribute, comparison, value); + break; + case Byte value: + filter.AddCondition(attribute, comparison, value); + break; + case Decimal value: + filter.AddCondition(attribute, comparison, value); + break; + case Double value: + filter.AddCondition(attribute, comparison, value); + break; + case Int16 value: + filter.AddCondition(attribute, comparison, value); + break; + case Int32 value: + filter.AddCondition(attribute, comparison, value); + break; + case Int64 value: + filter.AddCondition(attribute, comparison, value); + break; + case SByte value: + filter.AddCondition(attribute, comparison, value); + break; + case Single value: + filter.AddCondition(attribute, comparison, value); + break; + case String value: + filter.AddCondition(attribute, comparison, value); + break; + case UInt16 value: + filter.AddCondition(attribute, comparison, value); + break; + case UInt32 value: + filter.AddCondition(attribute, comparison, value); + break; + case UInt64 value: + filter.AddCondition(attribute, comparison, value); + break; + } } return filter; diff --git a/src/YuckQi.Data.DocumentDb.DynamoDb/Extensions/FilterOperationExtensions.cs b/src/YuckQi.Data.DocumentDb.DynamoDb/Extensions/FilterOperationExtensions.cs index 352b657..4e7f2a4 100644 --- a/src/YuckQi.Data.DocumentDb.DynamoDb/Extensions/FilterOperationExtensions.cs +++ b/src/YuckQi.Data.DocumentDb.DynamoDb/Extensions/FilterOperationExtensions.cs @@ -1,5 +1,5 @@ -using System; -using Amazon.DynamoDBv2; +using Amazon.DynamoDBv2; +using Amazon.DynamoDBv2.DocumentModel; using YuckQi.Data.Filtering; namespace YuckQi.Data.DocumentDb.DynamoDb.Extensions; @@ -20,4 +20,17 @@ public static ComparisonOperator ToComparisonOperator(this FilterOperation opera _ => throw new ArgumentOutOfRangeException(nameof(operation), operation, null) }; } + + public static QueryOperator ToQueryOperator(this FilterOperation operation) + { + return operation switch + { + FilterOperation.Equal => QueryOperator.Equal, + FilterOperation.GreaterThan => QueryOperator.GreaterThan, + FilterOperation.GreaterThanOrEqual => QueryOperator.GreaterThanOrEqual, + FilterOperation.LessThan => QueryOperator.LessThan, + FilterOperation.LessThanOrEqual => QueryOperator.LessThanOrEqual, + _ => throw new ArgumentOutOfRangeException(nameof(operation), operation, null) + }; + } } diff --git a/src/YuckQi.Data.DocumentDb.DynamoDb/YuckQi.Data.DocumentDb.DynamoDb.csproj b/src/YuckQi.Data.DocumentDb.DynamoDb/YuckQi.Data.DocumentDb.DynamoDb.csproj index 6bec1aa..6737b48 100644 --- a/src/YuckQi.Data.DocumentDb.DynamoDb/YuckQi.Data.DocumentDb.DynamoDb.csproj +++ b/src/YuckQi.Data.DocumentDb.DynamoDb/YuckQi.Data.DocumentDb.DynamoDb.csproj @@ -5,7 +5,7 @@ enable true Kevin J Lambert - 6.3.3 + 6.3.4 An implementation of YuckQi.Data for Amazon DynamoDB databases. YuckQi.Data https://github.com/Yuck/YuckQi.Data.git diff --git a/src/YuckQi.Data.DocumentDb.MongoDb/YuckQi.Data.DocumentDb.MongoDb.csproj b/src/YuckQi.Data.DocumentDb.MongoDb/YuckQi.Data.DocumentDb.MongoDb.csproj index e5a8cac..4044667 100644 --- a/src/YuckQi.Data.DocumentDb.MongoDb/YuckQi.Data.DocumentDb.MongoDb.csproj +++ b/src/YuckQi.Data.DocumentDb.MongoDb/YuckQi.Data.DocumentDb.MongoDb.csproj @@ -5,7 +5,7 @@ enable true Kevin J Lambert - 6.3.3 + 6.3.4 An implementation of YuckQi.Data for MongoDB databases. YuckQi.Data https://github.com/Yuck/YuckQi.Data.git diff --git a/src/YuckQi.Data.MemDb/YuckQi.Data.MemDb.csproj b/src/YuckQi.Data.MemDb/YuckQi.Data.MemDb.csproj index 48142db..0b15175 100644 --- a/src/YuckQi.Data.MemDb/YuckQi.Data.MemDb.csproj +++ b/src/YuckQi.Data.MemDb/YuckQi.Data.MemDb.csproj @@ -5,7 +5,7 @@ enable true Kevin J Lambert - 6.3.3 + 6.3.4 An implementation of YuckQi.Data for a in-memory "database" (ConcurrentDictionary), ideal for rapid development without external dependencies. YuckQi.Data https://github.com/Yuck/YuckQi.Data.git diff --git a/src/YuckQi.Data.Sql.Dapper.MySql/YuckQi.Data.Sql.Dapper.MySql.csproj b/src/YuckQi.Data.Sql.Dapper.MySql/YuckQi.Data.Sql.Dapper.MySql.csproj index cf61eaa..1f76786 100644 --- a/src/YuckQi.Data.Sql.Dapper.MySql/YuckQi.Data.Sql.Dapper.MySql.csproj +++ b/src/YuckQi.Data.Sql.Dapper.MySql/YuckQi.Data.Sql.Dapper.MySql.csproj @@ -5,7 +5,7 @@ enable true Kevin J Lambert - 6.3.3 + 6.3.4 An implementation of YuckQi.Data for MySQL databases using Dapper and SimpleCRUD. YuckQi.Data https://github.com/Yuck/YuckQi.Data.git diff --git a/src/YuckQi.Data.Sql.Dapper.Oracle/YuckQi.Data.Sql.Dapper.Oracle.csproj b/src/YuckQi.Data.Sql.Dapper.Oracle/YuckQi.Data.Sql.Dapper.Oracle.csproj index 1716f58..7c5decd 100644 --- a/src/YuckQi.Data.Sql.Dapper.Oracle/YuckQi.Data.Sql.Dapper.Oracle.csproj +++ b/src/YuckQi.Data.Sql.Dapper.Oracle/YuckQi.Data.Sql.Dapper.Oracle.csproj @@ -5,7 +5,7 @@ enable true Kevin J Lambert - 6.3.3 + 6.3.4 An implementation of YuckQi.Data for Oracle databases using Dapper and SimpleCRUD. YuckQi.Data https://github.com/Yuck/YuckQi.Data.git diff --git a/src/YuckQi.Data.Sql.Dapper.SqlServer/YuckQi.Data.Sql.Dapper.SqlServer.csproj b/src/YuckQi.Data.Sql.Dapper.SqlServer/YuckQi.Data.Sql.Dapper.SqlServer.csproj index ab7bff6..51533b1 100644 --- a/src/YuckQi.Data.Sql.Dapper.SqlServer/YuckQi.Data.Sql.Dapper.SqlServer.csproj +++ b/src/YuckQi.Data.Sql.Dapper.SqlServer/YuckQi.Data.Sql.Dapper.SqlServer.csproj @@ -5,7 +5,7 @@ enable true Kevin J Lambert - 6.3.3 + 6.3.4 An implementation of YuckQi.Data for MSSQL databases using Dapper and SimpleCRUD. YuckQi.Data https://github.com/Yuck/YuckQi.Data.git diff --git a/src/YuckQi.Data.Sql.Dapper/YuckQi.Data.Sql.Dapper.csproj b/src/YuckQi.Data.Sql.Dapper/YuckQi.Data.Sql.Dapper.csproj index af44795..87fe40a 100644 --- a/src/YuckQi.Data.Sql.Dapper/YuckQi.Data.Sql.Dapper.csproj +++ b/src/YuckQi.Data.Sql.Dapper/YuckQi.Data.Sql.Dapper.csproj @@ -5,7 +5,7 @@ enable true Kevin J Lambert - 6.3.3 + 6.3.4 An implementation of YuckQi.Data for SQL databases using Dapper and SimpleCRUD. YuckQi.Data https://github.com/Yuck/YuckQi.Data.git diff --git a/src/YuckQi.Data.Sql.EntityFramework/YuckQi.Data.Sql.EntityFramework.csproj b/src/YuckQi.Data.Sql.EntityFramework/YuckQi.Data.Sql.EntityFramework.csproj index 7fa8ea4..4a3ab53 100644 --- a/src/YuckQi.Data.Sql.EntityFramework/YuckQi.Data.Sql.EntityFramework.csproj +++ b/src/YuckQi.Data.Sql.EntityFramework/YuckQi.Data.Sql.EntityFramework.csproj @@ -5,7 +5,7 @@ enable true Kevin J Lambert - 6.3.3 + 6.3.4 An implementation of YuckQi.Data for SQL databases using Entity Framework. YuckQi.Data https://github.com/Yuck/YuckQi.Data.git diff --git a/src/YuckQi.Data/YuckQi.Data.csproj b/src/YuckQi.Data/YuckQi.Data.csproj index 33571f6..53346c1 100644 --- a/src/YuckQi.Data/YuckQi.Data.csproj +++ b/src/YuckQi.Data/YuckQi.Data.csproj @@ -5,7 +5,7 @@ enable true Kevin J Lambert - 6.3.3 + 6.3.4 A .NET library of lightweight data access handlers which can be used to compose repositories and domain services. https://github.com/Yuck/YuckQi.Data.git git