Пример #1
0
        public Task <IReadOnlyList <T> > QueryAsync(params Expression[] expressions)
        {
            var e = new DynamoQueryExpression(PrimaryKey.Names, expressions);

            var query = new DynamoQuery {
                KeyConditionExpression    = e.KeyExpression.Text,
                ExpressionAttributeNames  = (e.HasAttributeNames) ? e.AttributeNames : null,
                ExpressionAttributeValues = e.AttributeValues,
                FilterExpression          = e.FilterExpression?.Text
            };

            return(QueryAsync(query));
        }
Пример #2
0
        public Task <IList <T> > QueryAsync(Query q)
        {
            var e = new DynamoQueryExpression(PrimaryKey.Names, q.Expressions);

            var query = new DynamoQuery {
                IndexName = q.Index?.Name,
                Limit     = q.Take ?? 0,
                KeyConditionExpression    = e.KeyExpression.Text,
                ExpressionAttributeNames  = (e.HasAttributeNames) ? e.AttributeNames : null,
                ExpressionAttributeValues = e.AttributeValues,
                FilterExpression          = e.FilterExpression?.Text
            };

            if (q.Orders != null && q.Orders[0].IsDescending)
            {
                query.ScanIndexForward = false;
            }

            return(QueryAsync(query));
        }