diff --git a/README.md b/README.md index 280d7f9..c61d0e2 100644 --- a/README.md +++ b/README.md @@ -497,11 +497,7 @@ public static class InfluxClientExtensions /// /// /// - public static Task> ExecuteOperationAsync( this IInfluxClient client, string commandOrQuery, string db ) - where TInfluxRow : new() - { - return client.ExecuteOperationAsync( commandOrQuery, db, null ); - } + public static Task> ExecuteOperationAsync( this IInfluxClient client, string commandOrQuery, string db ); /// /// Executes an arbitrary command or query that returns a table as a result. @@ -510,11 +506,7 @@ public static class InfluxClientExtensions /// The IInfluxClient that performs operation. /// /// - public static Task> ExecuteOperationAsync( this IInfluxClient client, string commandOrQuery ) - where TInfluxRow : new() - { - return client.ExecuteOperationAsync( commandOrQuery, null, null ); - } + public static Task> ExecuteOperationAsync( this IInfluxClient client, string commandOrQuery ); /// /// Executes an arbitrary command or query that returns a table as a result. @@ -524,11 +516,7 @@ public static class InfluxClientExtensions /// /// /// - public static Task> ExecuteOperationAsync( this IInfluxClient client, string commandOrQuery, object parameters ) - where TInfluxRow : new() - { - return client.ExecuteOperationAsync( commandOrQuery, null, parameters ); - } + public static Task> ExecuteOperationAsync( this IInfluxClient client, string commandOrQuery, object parameters ); /// /// Executes an arbitrary command that does not return a table. @@ -537,10 +525,7 @@ public static class InfluxClientExtensions /// /// /// - public static Task ExecuteOperationAsync( this IInfluxClient client, string commandOrQuery, string db ) - { - return client.ExecuteOperationAsync( commandOrQuery, db, null ); - } + public static Task ExecuteOperationAsync( this IInfluxClient client, string commandOrQuery, string db ); /// /// Executes an arbitrary command that does not return a table. @@ -548,10 +533,7 @@ public static class InfluxClientExtensions /// The IInfluxClient that performs operation. /// /// - public static Task ExecuteOperationAsync( this IInfluxClient client, string commandOrQuery ) - { - return client.ExecuteOperationAsync( commandOrQuery, null, null ); - } + public static Task ExecuteOperationAsync( this IInfluxClient client, string commandOrQuery ); /// /// Executes an arbitrary command that does not return a table. @@ -560,10 +542,7 @@ public static class InfluxClientExtensions /// /// /// - public static Task ExecuteOperationAsync( this IInfluxClient client, string commandOrQuery, object parameters ) - { - return client.ExecuteOperationAsync( commandOrQuery, null, parameters ); - } + public static Task ExecuteOperationAsync( this IInfluxClient client, string commandOrQuery, object parameters ); #endregion @@ -575,12 +554,7 @@ public static class InfluxClientExtensions /// /// The IInfluxClient that performs operation. /// - public static async Task> ShowStatsAsync( this IInfluxClient client ) - where TInfluxRow : IInfluxRow, new() - { - var parserResult = await client.ExecuteOperationAsync( $"SHOW STATS" ).ConfigureAwait( false ); - return parserResult.Results.First(); - } + public static async Task> ShowStatsAsync( this IInfluxClient client ); /// /// Shows InfluxDB diagnostics. @@ -588,23 +562,14 @@ public static class InfluxClientExtensions /// /// The IInfluxClient that performs operation. /// - public static async Task> ShowDiagnosticsAsync( this IInfluxClient client ) - where TInfluxRow : IInfluxRow, new() - { - var parserResult = await client.ExecuteOperationAsync( $"SHOW DIAGNOSTICS" ).ConfigureAwait( false ); - return parserResult.Results.First(); - } + public static async Task> ShowDiagnosticsAsync( this IInfluxClient client ); /// /// Shows Shards. /// /// The IInfluxClient that performs operation. /// - public static async Task> ShowShards( this IInfluxClient client ) - { - var parserResult = await client.ExecuteOperationAsync( $"SHOW SHARDS" ).ConfigureAwait( false ); - return parserResult.Results.First(); - } + public static async Task> ShowShards( this IInfluxClient client ); #endregion @@ -617,10 +582,7 @@ public static class InfluxClientExtensions /// /// /// - public static Task CreateAdminUserAsync( this IInfluxClient client, string username, string password ) - { - return client.ExecuteOperationAsync( $"CREATE USER {username} WITH PASSWORD '{password}' WITH ALL PRIVILEGES" ); - } + public static Task CreateAdminUserAsync( this IInfluxClient client, string username, string password ); /// /// CREATE a new non-admin user. @@ -629,11 +591,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task CreateUserAsync( this IInfluxClient client, string username, string password ) - { - var resultSet = await client.ExecuteOperationAsync( $"CREATE USER {username} WITH PASSWORD '{password}'" ).ConfigureAwait( false ); - return resultSet.Results.FirstOrDefault(); - } + public static async Task CreateUserAsync( this IInfluxClient client, string username, string password ); /// /// GRANT administrative privileges to an existing user. @@ -641,11 +599,7 @@ public static class InfluxClientExtensions /// The IInfluxClient that performs operation. /// /// - public static async Task GrantAdminPrivilegesAsync( this IInfluxClient client, string username ) - { - var resultSet = await client.ExecuteOperationAsync( $"GRANT ALL PRIVILEGES TO {username}" ).ConfigureAwait( false ); - return resultSet.Results.FirstOrDefault(); - } + public static async Task GrantAdminPrivilegesAsync( this IInfluxClient client, string username ); /// /// GRANT READ, WRITE or ALL database privileges to an existing user. @@ -655,11 +609,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task GrantPrivilegeAsync( this IInfluxClient client, string db, DatabasePriviledge privilege, string username ) - { - var resultSet = await client.ExecuteOperationAsync( $"GRANT {GetPrivilege( privilege )} ON \"{db}\" TO {username}" ).ConfigureAwait( false ); - return resultSet.Results.FirstOrDefault(); - } + public static async Task GrantPrivilegeAsync( this IInfluxClient client, string db, DatabasePriviledge privilege, string username ); /// /// REVOKE administrative privileges from an admin user @@ -667,11 +617,7 @@ public static class InfluxClientExtensions /// The IInfluxClient that performs operation. /// /// - public static async Task RevokeAdminPrivilegesAsync( this IInfluxClient client, string username ) - { - var resultSet = await client.ExecuteOperationAsync( $"REVOKE ALL PRIVILEGES FROM {username}" ).ConfigureAwait( false ); - return resultSet.Results.FirstOrDefault(); - } + public static async Task RevokeAdminPrivilegesAsync( this IInfluxClient client, string username ); /// /// REVOKE READ, WRITE, or ALL database privileges from an existing user. @@ -681,11 +627,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task RevokePrivilegeAsync( this IInfluxClient client, string db, DatabasePriviledge privilege, string username ) - { - var resultSet = await client.ExecuteOperationAsync( $"REVOKE {GetPrivilege( privilege )} ON \"{db}\" FROM {username}" ).ConfigureAwait( false ); - return resultSet.Results.FirstOrDefault(); - } + public static async Task RevokePrivilegeAsync( this IInfluxClient client, string db, DatabasePriviledge privilege, string username ); /// /// SET a user’s password. @@ -694,11 +636,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task SetPasswordAsync( this IInfluxClient client, string username, string password ) - { - var resultSet = await client.ExecuteOperationAsync( $"SET PASSWORD FOR {username} = '{password}'" ).ConfigureAwait( false ); - return resultSet.Results.FirstOrDefault(); - } + public static async Task SetPasswordAsync( this IInfluxClient client, string username, string password ); /// /// DROP a user. @@ -706,22 +644,14 @@ public static class InfluxClientExtensions /// The IInfluxClient that performs operation. /// /// - public static async Task DropUserAsync( this IInfluxClient client, string username ) - { - var resultSet = await client.ExecuteOperationAsync( $"DROP USER {username}" ).ConfigureAwait( false ); - return resultSet.Results.FirstOrDefault(); - } + public static async Task DropUserAsync( this IInfluxClient client, string username ); /// /// SHOW all existing users and their admin status. /// /// The IInfluxClient that performs operation. /// - public static async Task> ShowUsersAsync( this IInfluxClient client ) - { - var parserResult = await client.ExecuteOperationAsync( $"SHOW USERS" ).ConfigureAwait( false ); - return parserResult.Results.First(); - } + public static async Task> ShowUsersAsync( this IInfluxClient client ); /// /// SHOW a user’s database privileges. @@ -729,26 +659,7 @@ public static class InfluxClientExtensions /// The IInfluxClient that performs operation. /// /// - public static async Task> ShowGrantsAsync( this IInfluxClient client, string username ) - { - var parserResult = await client.ExecuteOperationAsync( $"SHOW GRANTS FOR {username}" ).ConfigureAwait( false ); - return parserResult.Results.First(); - } - - private static string GetPrivilege( DatabasePriviledge privilege ) - { - switch( privilege ) - { - case DatabasePriviledge.Read: - return "READ"; - case DatabasePriviledge.Write: - return "WRITE"; - case DatabasePriviledge.All: - return "ALL"; - default: - throw new ArgumentException( "Invalid value.", nameof( privilege ) ); - } - } + public static async Task> ShowGrantsAsync( this IInfluxClient client, string username ); #endregion @@ -760,11 +671,7 @@ public static class InfluxClientExtensions /// The IInfluxClient that performs operation. /// /// - public static async Task CreateDatabaseAsync( this IInfluxClient client, string db ) - { - var resultSet = await client.ExecuteOperationAsync( $"CREATE DATABASE \"{db}\"" ).ConfigureAwait( false ); - return resultSet.Results.FirstOrDefault(); - } + public static async Task CreateDatabaseAsync( this IInfluxClient client, string db ); /// /// Delete a database with DROP DATABASE @@ -772,11 +679,7 @@ public static class InfluxClientExtensions /// The IInfluxClient that performs operation. /// /// - public static async Task DropDatabaseAsync( this IInfluxClient client, string db ) - { - var resultSet = await client.ExecuteOperationAsync( $"DROP DATABASE \"{db}\"" ).ConfigureAwait( false ); - return resultSet.Results.FirstOrDefault(); - } + public static async Task DropDatabaseAsync( this IInfluxClient client, string db ); /// /// Delete series with DROP SERIES @@ -785,11 +688,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task DropSeries( this IInfluxClient client, string db, string measurementName ) - { - var resultSet = await client.ExecuteOperationAsync( $"DROP SERIES FROM \"{measurementName}\"", db ).ConfigureAwait( false ); - return resultSet.Results.FirstOrDefault(); - } + public static async Task DropSeries( this IInfluxClient client, string db, string measurementName ); /// /// Delete series with DROP SERIES @@ -799,11 +698,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task DropSeries( this IInfluxClient client, string db, string measurementName, string where ) - { - var resultSet = await client.ExecuteOperationAsync( $"DROP SERIES FROM \"{measurementName}\" WHERE {where}", db ).ConfigureAwait( false ); - return resultSet.Results.FirstOrDefault(); - } + public static async Task DropSeries( this IInfluxClient client, string db, string measurementName, string where ); /// /// Delete measurements with DROP MEASUREMENT @@ -812,11 +707,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task DropMeasurementAsync( this IInfluxClient client, string db, string measurementName ) - { - var resultSet = await client.ExecuteOperationAsync( $"DROP MEASUREMENT \"{measurementName}\"", db ).ConfigureAwait( false ); - return resultSet.Results.FirstOrDefault(); - } + public static async Task DropMeasurementAsync( this IInfluxClient client, string db, string measurementName ); /// /// Create retention policies with CREATE RETENTION POLICY @@ -828,11 +719,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task CreateRetentionPolicyAsync( this IInfluxClient client, string db, string policyName, string duration, int replicationLevel, bool isDefault ) - { - var resultSet = await client.ExecuteOperationAsync( $"CREATE RETENTION POLICY \"{policyName}\" ON \"{db}\" DURATION {duration} REPLICATION {replicationLevel} {GetDefault( isDefault )}" ).ConfigureAwait( false ); - return resultSet.Results.FirstOrDefault(); - } + public static async Task CreateRetentionPolicyAsync( this IInfluxClient client, string db, string policyName, string duration, int replicationLevel, bool isDefault ); /// /// Create retention policies with CREATE RETENTION POLICY @@ -845,11 +732,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task CreateRetentionPolicyAsync( this IInfluxClient client, string db, string policyName, string duration, int replicationLevel, string shardGroupDuration, bool isDefault ) - { - var resultSet = await client.ExecuteOperationAsync( $"CREATE RETENTION POLICY \"{policyName}\" ON \"{db}\" DURATION {duration} REPLICATION {replicationLevel} {GetShardGroupDuration( shardGroupDuration )} {GetDefault( isDefault )}" ).ConfigureAwait( false ); - return resultSet.Results.FirstOrDefault(); - } + public static async Task CreateRetentionPolicyAsync( this IInfluxClient client, string db, string policyName, string duration, int replicationLevel, string shardGroupDuration, bool isDefault ); /// /// Modify retention policies with ALTER RETENTION POLICY @@ -861,11 +744,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task AlterRetentionPolicyAsync( this IInfluxClient client, string db, string policyName, string duration, int replicationLevel, bool isDefault ) - { - var resultSet = await client.ExecuteOperationAsync( $"ALTER RETENTION POLICY \"{policyName}\" ON \"{db}\" DURATION {duration} REPLICATION {replicationLevel} {GetDefault( isDefault )}" ).ConfigureAwait( false ); - return resultSet.Results.FirstOrDefault(); - } + public static async Task AlterRetentionPolicyAsync( this IInfluxClient client, string db, string policyName, string duration, int replicationLevel, bool isDefault ); /// /// Modify retention policies with ALTER RETENTION POLICY @@ -878,11 +757,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task AlterRetentionPolicyAsync( this IInfluxClient client, string db, string policyName, string duration, int replicationLevel, string shardGroupDuration, bool isDefault ) - { - var resultSet = await client.ExecuteOperationAsync( $"ALTER RETENTION POLICY \"{policyName}\" ON \"{db}\" DURATION {duration} REPLICATION {replicationLevel} {GetShardGroupDuration( shardGroupDuration )} {GetDefault( isDefault )}" ).ConfigureAwait( false ); - return resultSet.Results.FirstOrDefault(); - } + public static async Task AlterRetentionPolicyAsync( this IInfluxClient client, string db, string policyName, string duration, int replicationLevel, string shardGroupDuration, bool isDefault ); /// /// Delete retention policies with DROP RETENTION POLICY @@ -891,21 +766,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task DropRetentionPolicyAsync( this IInfluxClient client, string db, string policyName ) - { - var resultSet = await client.ExecuteOperationAsync( $"DROP RETENTION POLICY \"{policyName}\" ON \"{db}\"" ).ConfigureAwait( false ); - return resultSet.Results.FirstOrDefault(); - } - - private static string GetDefault( bool isDefault ) - { - return isDefault ? "DEFAULT" : string.Empty; - } - - private static string GetShardGroupDuration( string shardGroupDuration ) - { - return string.IsNullOrWhiteSpace( shardGroupDuration ) ? string.Empty : $"SHARD DURATION {shardGroupDuration}"; - } + public static async Task DropRetentionPolicyAsync( this IInfluxClient client, string db, string policyName ); #endregion @@ -917,11 +778,7 @@ public static class InfluxClientExtensions /// The IInfluxClient that performs operation. /// /// - public static async Task> ShowContinuousQueries( this IInfluxClient client, string db ) - { - var parserResult = await client.ExecuteOperationAsync( "SHOW CONTINUOUS QUERIES", db ).ConfigureAwait( false ); - return parserResult.Results.First(); - } + public static async Task> ShowContinuousQueries( this IInfluxClient client, string db ); /// /// Creates a continuous query. @@ -931,11 +788,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task CreateContinuousQuery( this IInfluxClient client, string db, string name, string continuousQuery ) - { - var resultSet = await client.ExecuteOperationAsync( $"CREATE CONTINUOUS QUERY \"{name}\" ON \"{db}\"\n{continuousQuery}", db ).ConfigureAwait( false ); - return resultSet.Results.FirstOrDefault(); - } + public static async Task CreateContinuousQuery( this IInfluxClient client, string db, string name, string continuousQuery ); /// /// Drops a continuous query. @@ -944,11 +797,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task DropContinuousQuery( this IInfluxClient client, string db, string name ) - { - var resultSet = await client.ExecuteOperationAsync( $"DROP CONTINUOUS QUERY \"{name}\" ON \"{db}\"", db ).ConfigureAwait( false ); - return resultSet.Results.FirstOrDefault(); - } + public static async Task DropContinuousQuery( this IInfluxClient client, string db, string name ); #endregion @@ -959,11 +808,7 @@ public static class InfluxClientExtensions /// /// The IInfluxClient that performs operation. /// - public static async Task> ShowDatabasesAsync( this IInfluxClient client ) - { - var parserResult = await client.ExecuteOperationAsync( $"SHOW DATABASES" ).ConfigureAwait( false ); - return parserResult.Results.First(); - } + public static async Task> ShowDatabasesAsync( this IInfluxClient client ); /// /// The SHOW RETENTION POLICIES query lists the existing retention policies on a given database. @@ -971,11 +816,7 @@ public static class InfluxClientExtensions /// The IInfluxClient that performs operation. /// /// - public static async Task> ShowRetentionPoliciesAsync( this IInfluxClient client, string db ) - { - var parserResult = await client.ExecuteOperationAsync( $"SHOW RETENTION POLICIES ON \"{db}\"", db ).ConfigureAwait( false ); - return parserResult.Results.First(); - } + public static async Task> ShowRetentionPoliciesAsync( this IInfluxClient client, string db ); /// /// The SHOW SERIES query returns the distinct series in your database. @@ -983,11 +824,7 @@ public static class InfluxClientExtensions /// The IInfluxClient that performs operation. /// /// - public static async Task> ShowSeriesAsync( this IInfluxClient client, string db ) - { - var parserResult = await client.ExecuteOperationAsync( $"SHOW SERIES", db ).ConfigureAwait( false ); - return parserResult.Results.First(); - } + public static async Task> ShowSeriesAsync( this IInfluxClient client, string db ); /// /// The SHOW SERIES query returns the distinct series in your database. @@ -997,11 +834,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task> ShowSeriesAsync( this IInfluxClient client, string db, string measurementName ) - { - var parserResult = await client.ExecuteOperationAsync( $"SHOW SERIES FROM \"{measurementName}\"", db ).ConfigureAwait( false ); - return parserResult.Results.First(); - } + public static async Task> ShowSeriesAsync( this IInfluxClient client, string db, string measurementName ); /// /// The SHOW SERIES query returns the distinct series in your database. @@ -1012,11 +845,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task> ShowSeriesAsync( this IInfluxClient client, string db, string measurementName, string where ) - { - var parserResult = await client.ExecuteOperationAsync( $"SHOW SERIES FROM \"{measurementName}\" WHERE {where}", db ).ConfigureAwait( false ); - return parserResult.Results.First(); - } + public static async Task> ShowSeriesAsync( this IInfluxClient client, string db, string measurementName, string where ); /// /// The SHOW MEASUREMENTS query returns the measurements in your database. @@ -1024,11 +853,7 @@ public static class InfluxClientExtensions /// The IInfluxClient that performs operation. /// /// - public static async Task> ShowMeasurementsAsync( this IInfluxClient client, string db ) - { - var parserResult = await client.ExecuteOperationAsync( "SHOW MEASUREMENTS", db ).ConfigureAwait( false ); - return parserResult.Results.First(); - } + public static async Task> ShowMeasurementsAsync( this IInfluxClient client, string db ); /// /// The SHOW MEASUREMENTS query returns the measurements in your database. @@ -1037,11 +862,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task> ShowMeasurementsAsync( this IInfluxClient client, string db, string where ) - { - var parserResult = await client.ExecuteOperationAsync( $"SHOW MEASUREMENTS WHERE {where}", db ).ConfigureAwait( false ); - return parserResult.Results.First(); - } + public static async Task> ShowMeasurementsAsync( this IInfluxClient client, string db, string where ); /// /// The SHOW MEASUREMENTS query returns the measurements in your database. @@ -1050,11 +871,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task> ShowMeasurementsWithMeasurementAsync( this IInfluxClient client, string db, string measurementRegex ) - { - var parserResult = await client.ExecuteOperationAsync( $"SHOW MEASUREMENTS WITH MEASUREMENT =~ {measurementRegex}", db ).ConfigureAwait( false ); - return parserResult.Results.First(); - } + public static async Task> ShowMeasurementsWithMeasurementAsync( this IInfluxClient client, string db, string measurementRegex ); /// /// The SHOW MEASUREMENTS query returns the measurements in your database. @@ -1064,11 +881,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task> ShowMeasurementsWithMeasurementAsync( this IInfluxClient client, string db, string measurementRegex, string where ) - { - var parserResult = await client.ExecuteOperationAsync( $"SHOW MEASUREMENTS WITH MEASUREMENT =~ {measurementRegex} WHERE {where}", db ).ConfigureAwait( false ); - return parserResult.Results.First(); - } + public static async Task> ShowMeasurementsWithMeasurementAsync( this IInfluxClient client, string db, string measurementRegex, string where ); /// /// SHOW TAG KEYS returns the tag keys associated with each measurement. @@ -1076,11 +889,7 @@ public static class InfluxClientExtensions /// The IInfluxClient that performs operation. /// /// - public static async Task> ShowTagKeysAsync( this IInfluxClient client, string db ) - { - var parserResult = await client.ExecuteOperationAsync( "SHOW TAG KEYS", db ).ConfigureAwait( false ); - return parserResult.Results.First(); - } + public static async Task> ShowTagKeysAsync( this IInfluxClient client, string db ); /// /// SHOW TAG KEYS returns the tag keys associated with each measurement. @@ -1089,11 +898,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task> ShowTagKeysAsync( this IInfluxClient client, string db, string measurementName ) - { - var parserResult = await client.ExecuteOperationAsync( $"SHOW TAG KEYS FROM \"{measurementName}\"", db ).ConfigureAwait( false ); - return parserResult.Results.First(); - } + public static async Task> ShowTagKeysAsync( this IInfluxClient client, string db, string measurementName ); /// /// The SHOW TAG VALUES query returns the set of tag values for a specific tag key across all measurements in the database. @@ -1104,12 +909,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task> ShowTagValuesAsAsync( this IInfluxClient client, string db, string tagKey ) - where TInfluxRow : ITagValueRow, new() - { - var parserResult = await client.ExecuteOperationAsync( $"SHOW TAG VALUES WITH KEY = \"{tagKey}\"", db ).ConfigureAwait( false ); - return parserResult.Results.First(); - } + public static async Task> ShowTagValuesAsAsync( this IInfluxClient client, string db, string tagKey ); /// /// The SHOW TAG VALUES query returns the set of tag values for a specific tag key across all measurements in the database. @@ -1121,12 +921,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task> ShowTagValuesAsAsync( this IInfluxClient client, string db, string tagKey, string measurementName ) - where TInfluxRow : ITagValueRow, new() - { - var parserResult = await client.ExecuteOperationAsync( $"SHOW TAG VALUES FROM \"{measurementName}\" WITH KEY = \"{tagKey}\"", db ).ConfigureAwait( false ); - return parserResult.Results.First(); - } + public static async Task> ShowTagValuesAsAsync( this IInfluxClient client, string db, string tagKey, string measurementName ); /// /// The SHOW TAG VALUES query returns the set of tag values for a specific tag key across all measurements in the database. @@ -1135,10 +930,7 @@ public static class InfluxClientExtensions /// /// /// - public static Task> ShowTagValuesAsync( this IInfluxClient client, string db, string tagKey ) - { - return client.ShowTagValuesAsAsync( db, tagKey ); - } + public static Task> ShowTagValuesAsync( this IInfluxClient client, string db, string tagKey ); /// /// The SHOW TAG VALUES query returns the set of tag values for a specific tag key across all measurements in the database. @@ -1148,10 +940,7 @@ public static class InfluxClientExtensions /// /// /// - public static Task> ShowTagValuesAsync( this IInfluxClient client, string db, string tagKey, string measurementName ) - { - return client.ShowTagValuesAsAsync( db, tagKey, measurementName ); - } + public static Task> ShowTagValuesAsync( this IInfluxClient client, string db, string tagKey, string measurementName ); /// @@ -1160,11 +949,7 @@ public static class InfluxClientExtensions /// The IInfluxClient that performs operation. /// /// - public static async Task> ShowFieldKeysAsync( this IInfluxClient client, string db ) - { - var parserResult = await client.ExecuteOperationAsync( $"SHOW FIELD KEYS", db ).ConfigureAwait( false ); - return parserResult.Results.First(); - } + public static async Task> ShowFieldKeysAsync( this IInfluxClient client, string db ); /// /// The SHOW FIELD KEYS query returns the field keys across each measurement in the database. @@ -1173,11 +958,7 @@ public static class InfluxClientExtensions /// /// /// - public static async Task> ShowFieldKeysAsync( this IInfluxClient client, string db, string measurementName ) - { - var parserResult = await client.ExecuteOperationAsync( $"SHOW FIELD KEYS FROM \"{measurementName}\"", db ).ConfigureAwait( false ); - return parserResult.Results.First(); - } + public static async Task> ShowFieldKeysAsync( this IInfluxClient client, string db, string measurementName ); #endregion @@ -1188,10 +969,7 @@ public static class InfluxClientExtensions /// /// The IInfluxClient that performs operation. /// - public static Task PingAsync( this IInfluxClient client ) - { - return client.PingAsync( null ); - } + public static Task PingAsync( this IInfluxClient client ); #endregion @@ -1206,11 +984,7 @@ public static class InfluxClientExtensions /// /// /// - public static Task WriteAsync( this IInfluxClient client, string db, string measurementName, IEnumerable rows ) - where TInfluxRow : new() - { - return client.WriteAsync( db, measurementName, rows, client.DefaultWriteOptions ); - } + public static Task WriteAsync( this IInfluxClient client, string db, string measurementName, IEnumerable rows ); /// /// Writes the rows with default write options. @@ -1220,11 +994,7 @@ public static class InfluxClientExtensions /// /// /// - public static Task WriteAsync( this IInfluxClient client, string db, IEnumerable rows ) - where TInfluxRow : new() - { - return client.WriteAsync( db, null, rows, client.DefaultWriteOptions ); - } + public static Task WriteAsync( this IInfluxClient client, string db, IEnumerable rows ); /// /// Writes the rows with the specified write options. @@ -1235,11 +1005,7 @@ public static class InfluxClientExtensions /// /// /// - public static Task WriteAsync( this IInfluxClient client, string db, IEnumerable rows, InfluxWriteOptions options ) - where TInfluxRow : new() - { - return client.WriteAsync( db, null, rows, options ); - } + public static Task WriteAsync( this IInfluxClient client, string db, IEnumerable rows, InfluxWriteOptions options ); /// /// Executes the query and returns the result with the default query options. @@ -1249,11 +1015,7 @@ public static class InfluxClientExtensions /// /// /// - public static Task> ReadAsync( this IInfluxClient client, string db, string query ) - where TInfluxRow : new() - { - return client.ReadAsync( db, query, null, client.DefaultQueryOptions ); - } + public static Task> ReadAsync( this IInfluxClient client, string db, string query ); /// /// Executes the query and returns the result with the default query options. @@ -1264,11 +1026,7 @@ public static class InfluxClientExtensions /// /// /// - public static Task> ReadAsync( this IInfluxClient client, string db, string query, object parameters ) - where TInfluxRow : new() - { - return client.ReadAsync( db, query, parameters, client.DefaultQueryOptions ); - } + public static Task> ReadAsync( this IInfluxClient client, string db, string query, object parameters ); /// /// Executes the query and returns the result with the specified query options. @@ -1279,11 +1037,7 @@ public static class InfluxClientExtensions /// /// /// - public static Task> ReadAsync( this IInfluxClient client, string db, string query, InfluxQueryOptions options ) - where TInfluxRow : new() - { - return client.ReadAsync( db, query, null, options ); - } + public static Task> ReadAsync( this IInfluxClient client, string db, string query, InfluxQueryOptions options ); /// /// Executes the query and returns a deferred result that can be iterated over as they @@ -1297,11 +1051,7 @@ public static class InfluxClientExtensions /// /// /// - public static Task> ReadChunkedAsync( this IInfluxClient client, string db, string query ) - where TInfluxRow : new() - { - return client.ReadChunkedAsync( db, query, null, client.DefaultQueryOptions ); - } + public static Task> ReadChunkedAsync( this IInfluxClient client, string db, string query ); /// /// Executes the query and returns a deferred result that can be iterated over as they @@ -1316,11 +1066,7 @@ public static class InfluxClientExtensions /// /// /// - public static Task> ReadChunkedAsync( this IInfluxClient client, string db, string query, object parameters ) - where TInfluxRow : new() - { - return client.ReadChunkedAsync( db, query, parameters, client.DefaultQueryOptions ); - } + public static Task> ReadChunkedAsync( this IInfluxClient client, string db, string query, object parameters ); /// /// Executes the query and returns a deferred result that can be iterated over as they @@ -1335,11 +1081,7 @@ public static class InfluxClientExtensions /// /// /// - public static Task> ReadChunkedAsync( this IInfluxClient client, string db, string query, InfluxQueryOptions options ) - where TInfluxRow : new() - { - return client.ReadChunkedAsync( db, query, null, options ); - } + public static Task> ReadChunkedAsync( this IInfluxClient client, string db, string query, InfluxQueryOptions options ); /// /// Deletes data in accordance with the specified query @@ -1348,10 +1090,7 @@ public static class InfluxClientExtensions /// /// /// - public static Task DeleteAsync( this IInfluxClient client, string db, string deleteQuery ) - { - return client.DeleteAsync( db, deleteQuery, null ); - } + public static Task DeleteAsync( this IInfluxClient client, string db, string deleteQuery ); /// /// Deletes all data older than the specified timestamp. @@ -1361,10 +1100,7 @@ public static class InfluxClientExtensions /// /// /// - public static Task DeleteOlderThanAsync( this IInfluxClient client, string db, string measurementName, DateTime to ) - { - return client.DeleteAsync( db, $"DELETE FROM \"{measurementName}\" WHERE time < $to", new { to } ); - } + public static Task DeleteOlderThanAsync( this IInfluxClient client, string db, string measurementName, DateTime to ); /// /// Deletes all data in the specified range. @@ -1375,10 +1111,7 @@ public static class InfluxClientExtensions /// /// /// - public static Task DeleteRangeAsync( this IInfluxClient client, string db, string measurementName, DateTime from, DateTime to ) - { - return client.DeleteAsync( db, $"DELETE FROM \"{measurementName}\" WHERE $from <= time AND time < $to", new { from, to } ); - } + public static Task DeleteRangeAsync( this IInfluxClient client, string db, string measurementName, DateTime from, DateTime to ); #endregion }