-
Notifications
You must be signed in to change notification settings - Fork 2
Geospatial Commands #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Geospatial Commands #107
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
2d616c7
GeoAdd, GeoDist
alexr-bq e64573b
rest of geo commands except search
alexr-bq 4b28727
GeoSearch
alexr-bq 4eae3ca
GeoSearch
alexr-bq 6c5c594
Add comprehensive invalid argument testing
alexr-bq 1259a11
Add GEOADD options (NX, XX, CH)
alexr-bq f72b2e4
Add extensive unit testing (meters, feet, miles), similar to java test
alexr-bq 1a96e41
Add edge case tests
alexr-bq 07b2b99
Add comprehensive GEOSEARCHSTORE result verification
alexr-bq 668acfb
Unit tests
alexr-bq c72d96a
Add batch tests
alexr-bq 5276ba5
Remove BYPOLYGON support
alexr-bq 4dfb7e4
Cleanup
alexr-bq 2133d68
Resolve feedback
alexr-bq 3d5a80a
Update sources/Valkey.Glide/Commands/IGeospatialCommands.cs
alexr-bq 6e35801
fix
alexr-bq dae7a7c
Update tests/Valkey.Glide.IntegrationTests/GeospatialCommandTests.cs
alexr-bq 5fed14e
Address PR feedback
alexr-bq 749f3aa
Fix
alexr-bq 4231149
Resolve conflict
alexr-bq e05fd11
fix test
alexr-bq 204928d
Format
alexr-bq 9eda371
Fix
alexr-bq 94b3047
Format
alexr-bq 756334e
Format
alexr-bq cd4a43d
Format
alexr-bq d552762
Format
alexr-bq f3a5216
Format
alexr-bq 4ad2575
Format
alexr-bq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,106 @@ | ||
| // Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 | ||
|
|
||
| using Valkey.Glide.Commands; | ||
| using Valkey.Glide.Internals; | ||
|
|
||
| namespace Valkey.Glide; | ||
|
|
||
| public abstract partial class BaseClient : IGeospatialCommands | ||
| { | ||
| /// <inheritdoc/> | ||
| public async Task<bool> GeoAddAsync(ValkeyKey key, double longitude, double latitude, ValkeyValue member, CommandFlags flags = CommandFlags.None) | ||
| { | ||
| return await GeoAddAsync(key, new GeoEntry(longitude, latitude, member), flags).ConfigureAwait(false); | ||
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| public async Task<bool> GeoAddAsync(ValkeyKey key, GeoEntry value, CommandFlags flags = CommandFlags.None) | ||
| { | ||
| Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); | ||
| return await Command(Request.GeoAddAsync(key, value)); | ||
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| public async Task<long> GeoAddAsync(ValkeyKey key, GeoEntry[] values, CommandFlags flags = CommandFlags.None) | ||
| { | ||
| Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); | ||
| return await Command(Request.GeoAddAsync(key, values)); | ||
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| public async Task<bool> GeoAddAsync(ValkeyKey key, GeoEntry value, GeoAddOptions options, CommandFlags flags = CommandFlags.None) | ||
| { | ||
| Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); | ||
| return await Command(Request.GeoAddAsync(key, value, options)); | ||
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| public async Task<long> GeoAddAsync(ValkeyKey key, GeoEntry[] values, GeoAddOptions options, CommandFlags flags = CommandFlags.None) | ||
| { | ||
| Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); | ||
| return await Command(Request.GeoAddAsync(key, values, options)); | ||
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| public async Task<double?> GeoDistanceAsync(ValkeyKey key, ValkeyValue member1, ValkeyValue member2, GeoUnit unit = GeoUnit.Meters, CommandFlags flags = CommandFlags.None) | ||
| { | ||
| Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); | ||
| return await Command(Request.GeoDistanceAsync(key, member1, member2, unit)); | ||
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| public async Task<string?> GeoHashAsync(ValkeyKey key, ValkeyValue member, CommandFlags flags = CommandFlags.None) | ||
| { | ||
| Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); | ||
| return await Command(Request.GeoHashAsync(key, member)); | ||
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| public async Task<string?[]> GeoHashAsync(ValkeyKey key, ValkeyValue[] members, CommandFlags flags = CommandFlags.None) | ||
| { | ||
| Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); | ||
| return await Command(Request.GeoHashAsync(key, members)); | ||
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| public async Task<GeoPosition?> GeoPositionAsync(ValkeyKey key, ValkeyValue member, CommandFlags flags = CommandFlags.None) | ||
| { | ||
| Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); | ||
| return await Command(Request.GeoPositionAsync(key, member)); | ||
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| public async Task<GeoPosition?[]> GeoPositionAsync(ValkeyKey key, ValkeyValue[] members, CommandFlags flags = CommandFlags.None) | ||
| { | ||
| Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); | ||
| return await Command(Request.GeoPositionAsync(key, members)); | ||
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| public async Task<GeoRadiusResult[]> GeoSearchAsync(ValkeyKey key, ValkeyValue fromMember, GeoSearchShape shape, long count = -1, bool demandClosest = true, Order? order = null, GeoRadiusOptions options = GeoRadiusOptions.Default, CommandFlags flags = CommandFlags.None) | ||
| { | ||
| Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); | ||
| return await Command(Request.GeoSearchAsync(key, fromMember, shape, count, demandClosest, order, options)); | ||
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| public async Task<GeoRadiusResult[]> GeoSearchAsync(ValkeyKey key, GeoPosition fromPosition, GeoSearchShape shape, long count = -1, bool demandClosest = true, Order? order = null, GeoRadiusOptions options = GeoRadiusOptions.Default, CommandFlags flags = CommandFlags.None) | ||
| { | ||
| Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); | ||
| return await Command(Request.GeoSearchAsync(key, fromPosition, shape, count, demandClosest, order, options)); | ||
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| public async Task<long> GeoSearchAndStoreAsync(ValkeyKey sourceKey, ValkeyKey destinationKey, ValkeyValue fromMember, GeoSearchShape shape, long count = -1, bool demandClosest = true, Order? order = null, bool storeDistances = false, CommandFlags flags = CommandFlags.None) | ||
| { | ||
| Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); | ||
| return await Command(Request.GeoSearchAndStoreAsync(sourceKey, destinationKey, fromMember, shape, count, demandClosest, order, storeDistances)); | ||
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| public async Task<long> GeoSearchAndStoreAsync(ValkeyKey sourceKey, ValkeyKey destinationKey, GeoPosition fromPosition, GeoSearchShape shape, long count = -1, bool demandClosest = true, Order? order = null, bool storeDistances = false, CommandFlags flags = CommandFlags.None) | ||
| { | ||
| Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); | ||
| return await Command(Request.GeoSearchAndStoreAsync(sourceKey, destinationKey, fromPosition, shape, count, demandClosest, order, storeDistances)); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.