|
| 1 | +// Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 |
| 2 | + |
| 3 | +using Valkey.Glide.Commands; |
| 4 | +using Valkey.Glide.Internals; |
| 5 | + |
| 6 | +namespace Valkey.Glide; |
| 7 | + |
| 8 | +public abstract partial class BaseClient : IGeospatialCommands |
| 9 | +{ |
| 10 | + /// <inheritdoc/> |
| 11 | + public async Task<bool> GeoAddAsync(ValkeyKey key, double longitude, double latitude, ValkeyValue member, CommandFlags flags = CommandFlags.None) |
| 12 | + { |
| 13 | + return await GeoAddAsync(key, new GeoEntry(longitude, latitude, member), flags).ConfigureAwait(false); |
| 14 | + } |
| 15 | + |
| 16 | + /// <inheritdoc/> |
| 17 | + public async Task<bool> GeoAddAsync(ValkeyKey key, GeoEntry value, CommandFlags flags = CommandFlags.None) |
| 18 | + { |
| 19 | + Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); |
| 20 | + return await Command(Request.GeoAddAsync(key, value)); |
| 21 | + } |
| 22 | + |
| 23 | + /// <inheritdoc/> |
| 24 | + public async Task<long> GeoAddAsync(ValkeyKey key, GeoEntry[] values, CommandFlags flags = CommandFlags.None) |
| 25 | + { |
| 26 | + Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); |
| 27 | + return await Command(Request.GeoAddAsync(key, values)); |
| 28 | + } |
| 29 | + |
| 30 | + /// <inheritdoc/> |
| 31 | + public async Task<bool> GeoAddAsync(ValkeyKey key, GeoEntry value, GeoAddOptions options, CommandFlags flags = CommandFlags.None) |
| 32 | + { |
| 33 | + Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); |
| 34 | + return await Command(Request.GeoAddAsync(key, value, options)); |
| 35 | + } |
| 36 | + |
| 37 | + /// <inheritdoc/> |
| 38 | + public async Task<long> GeoAddAsync(ValkeyKey key, GeoEntry[] values, GeoAddOptions options, CommandFlags flags = CommandFlags.None) |
| 39 | + { |
| 40 | + Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); |
| 41 | + return await Command(Request.GeoAddAsync(key, values, options)); |
| 42 | + } |
| 43 | + |
| 44 | + /// <inheritdoc/> |
| 45 | + public async Task<double?> GeoDistanceAsync(ValkeyKey key, ValkeyValue member1, ValkeyValue member2, GeoUnit unit = GeoUnit.Meters, CommandFlags flags = CommandFlags.None) |
| 46 | + { |
| 47 | + Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); |
| 48 | + return await Command(Request.GeoDistanceAsync(key, member1, member2, unit)); |
| 49 | + } |
| 50 | + |
| 51 | + /// <inheritdoc/> |
| 52 | + public async Task<string?> GeoHashAsync(ValkeyKey key, ValkeyValue member, CommandFlags flags = CommandFlags.None) |
| 53 | + { |
| 54 | + Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); |
| 55 | + return await Command(Request.GeoHashAsync(key, member)); |
| 56 | + } |
| 57 | + |
| 58 | + /// <inheritdoc/> |
| 59 | + public async Task<string?[]> GeoHashAsync(ValkeyKey key, ValkeyValue[] members, CommandFlags flags = CommandFlags.None) |
| 60 | + { |
| 61 | + Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); |
| 62 | + return await Command(Request.GeoHashAsync(key, members)); |
| 63 | + } |
| 64 | + |
| 65 | + /// <inheritdoc/> |
| 66 | + public async Task<GeoPosition?> GeoPositionAsync(ValkeyKey key, ValkeyValue member, CommandFlags flags = CommandFlags.None) |
| 67 | + { |
| 68 | + Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); |
| 69 | + return await Command(Request.GeoPositionAsync(key, member)); |
| 70 | + } |
| 71 | + |
| 72 | + /// <inheritdoc/> |
| 73 | + public async Task<GeoPosition?[]> GeoPositionAsync(ValkeyKey key, ValkeyValue[] members, CommandFlags flags = CommandFlags.None) |
| 74 | + { |
| 75 | + Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); |
| 76 | + return await Command(Request.GeoPositionAsync(key, members)); |
| 77 | + } |
| 78 | + |
| 79 | + /// <inheritdoc/> |
| 80 | + 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) |
| 81 | + { |
| 82 | + Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); |
| 83 | + return await Command(Request.GeoSearchAsync(key, fromMember, shape, count, demandClosest, order, options)); |
| 84 | + } |
| 85 | + |
| 86 | + /// <inheritdoc/> |
| 87 | + 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) |
| 88 | + { |
| 89 | + Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); |
| 90 | + return await Command(Request.GeoSearchAsync(key, fromPosition, shape, count, demandClosest, order, options)); |
| 91 | + } |
| 92 | + |
| 93 | + /// <inheritdoc/> |
| 94 | + 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) |
| 95 | + { |
| 96 | + Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); |
| 97 | + return await Command(Request.GeoSearchAndStoreAsync(sourceKey, destinationKey, fromMember, shape, count, demandClosest, order, storeDistances)); |
| 98 | + } |
| 99 | + |
| 100 | + /// <inheritdoc/> |
| 101 | + 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) |
| 102 | + { |
| 103 | + Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE"); |
| 104 | + return await Command(Request.GeoSearchAndStoreAsync(sourceKey, destinationKey, fromPosition, shape, count, demandClosest, order, storeDistances)); |
| 105 | + } |
| 106 | +} |
0 commit comments