-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for GROUP BY queries (#74)
* Fix #72 Retrieving ContinuationToken after a query with a GROUP BY is throwing an exception. * Add missing keywords/function for aggregate queries * Fix issue for queries with that respond with only 1 value (not object) * Try to remove system properties only from JObject
- Loading branch information
1 parent
2eb0970
commit 8c06eb5
Showing
10 changed files
with
103 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/CosmosDbExplorer.Core/Helpers/FeedResponseExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
using Microsoft.Azure.Cosmos; | ||
|
||
namespace CosmosDbExplorer.Core.Helpers | ||
{ | ||
public static class FeedResponseExtensions | ||
{ | ||
public static string? GetContinuationTokenSafely<T>(this FeedResponse<T> feedResponse) | ||
{ | ||
try | ||
{ | ||
return feedResponse.ContinuationToken; | ||
} | ||
catch (ArgumentException ex) when (ex.Message == "Continuation token is not supported for queries with GROUP BY. Do not use FeedResponse.ResponseContinuation or remove the GROUP BY from the query.") | ||
{ | ||
// Silently catch exception | ||
return null; | ||
} | ||
} | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/CosmosDbExplorer.Core/Models/CosmosQuerySyntaxException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
using Newtonsoft.Json; | ||
|
||
namespace CosmosDbExplorer.Core.Models | ||
{ | ||
public class CosmosQuerySyntaxException | ||
{ | ||
[JsonProperty("errors")] | ||
public List<Error>? Errors { get; set; } | ||
} | ||
|
||
public partial class Error | ||
{ | ||
[JsonProperty("severity")] | ||
public string? Severity { get; set; } | ||
|
||
[JsonProperty("location")] | ||
public Location? Location { get; set; } | ||
|
||
[JsonProperty("code")] | ||
public string? Code { get; set; } | ||
|
||
[JsonProperty("message")] | ||
public string? Message { get; set; } | ||
} | ||
|
||
public partial class Location | ||
{ | ||
[JsonProperty("start")] | ||
public long? Start { get; set; } | ||
|
||
[JsonProperty("end")] | ||
public long? End { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters