internal static IEnumerable <QueryArgument> ToQueryArguments(this LocalSecondaryIndexDescription index, IEnumerable <AttributeDefinition> attributes) { foreach (var key in index.KeySchema) { yield return(ToQueryArgument(attributes, key.AttributeName)); } foreach (var attributeName in index.Projection.NonKeyAttributes) { yield return(ToQueryArgument(attributes, attributeName)); } }
private QueryRequest ToQuery(ResolveFieldContext context, string tableName, LocalSecondaryIndexDescription index) { var arguments = context.Arguments.Select(arg => GetArgument(arg, index.KeySchema)); return(new QueryRequest(tableName) { Select = Select.ALL_ATTRIBUTES, IndexName = index.IndexName, KeyConditionExpression = String.Join(" and ", arguments.Select(_ => $"{_.Key} = :v_{_.Key}")), ExpressionAttributeValues = arguments.ToDictionary(_ => $":v_{_.Key}", _ => new AttributeValue { S = _.Value.ToString() }) }); }